remove all changes from eslint --fix

This commit is contained in:
Matteo Pagliazzi
2016-03-08 17:45:14 +01:00
parent eeebe4c342
commit 5a2daabada
37 changed files with 224 additions and 223 deletions

View File

@@ -4,28 +4,28 @@ import _ from 'lodash';
import splitWhitespace from '../libs/splitWhitespace';
import planGemLimits from '../libs/planGemLimits';
module.exports = function (user, req, cb, analytics) {
module.exports = function(user, req, cb, analytics) {
var analyticsData, convCap, convRate, item, key, price, ref, ref1, ref2, ref3, type;
ref = req.params, type = ref.type, key = ref.key;
if (type === 'gems' && key === 'gem') {
ref1 = planGemLimits, convRate = ref1.convRate, convCap = ref1.convCap;
ref1 = api.planGemLimits, convRate = ref1.convRate, convCap = ref1.convCap;
convCap += user.purchased.plan.consecutive.gemCapExtra;
if (!((ref2 = user.purchased) !== null ? (ref3 = ref2.plan) !== null ? ref3.customerId : void 0 : void 0)) {
return typeof cb === 'function' ? cb({
if (!((ref2 = user.purchased) != null ? (ref3 = ref2.plan) != null ? ref3.customerId : void 0 : void 0)) {
return typeof cb === "function" ? cb({
code: 401,
message: 'Must subscribe to purchase gems with GP'
message: "Must subscribe to purchase gems with GP"
}, req) : void 0;
}
if (!(user.stats.gp >= convRate)) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 401,
message: 'Not enough Gold'
message: "Not enough Gold"
}) : void 0;
}
if (user.purchased.plan.gemsBought >= convCap) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 401,
message: 'You\'ve reached the Gold=>Gem conversion cap (' + convCap + ') for this month. We have this to prevent abuse / farming. The cap will reset within the first three days of next month.'
message: "You've reached the Gold=>Gem conversion cap (" + convCap + ") for this month. We have this to prevent abuse / farming. The cap will reset within the first three days of next month."
}) : void 0;
}
user.balance += .25;
@@ -38,24 +38,24 @@ module.exports = function (user, req, cb, analytics) {
goldCost: convRate,
category: 'behavior'
};
if (analytics !== null) {
if (analytics != null) {
analytics.track('purchase gems', analyticsData);
}
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 200,
message: '+1 Gem'
message: "+1 Gem"
}, _.pick(user, splitWhitespace('stats balance'))) : void 0;
}
if (type !== 'eggs' && type !== 'hatchingPotions' && type !== 'food' && type !== 'quests' && type !== 'gear') {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 404,
message: ':type must be in [eggs,hatchingPotions,food,quests,gear]'
message: ":type must be in [eggs,hatchingPotions,food,quests,gear]"
}, req) : void 0;
}
if (type === 'gear') {
item = content.gear.flat[key];
if (user.items.gear.owned[key]) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 401,
message: i18n.t('alreadyHave', req.language)
}) : void 0;
@@ -66,19 +66,19 @@ module.exports = function (user, req, cb, analytics) {
price = item.value / 4;
}
if (!item) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 404,
message: ':key not found for Content.' + type
message: ":key not found for Content." + type
}, req) : void 0;
}
if (!item.canBuy(user)) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 403,
message: i18n.t('messageNotAvailable', req.language)
}) : void 0;
}
if ((user.balance < price) || !user.balance) {
return typeof cb === 'function' ? cb({
return typeof cb === "function" ? cb({
code: 403,
message: i18n.t('notEnoughGems', req.language)
}) : void 0;
@@ -100,8 +100,8 @@ module.exports = function (user, req, cb, analytics) {
gemCost: item.value,
category: 'behavior'
};
if (analytics !== null) {
if (analytics != null) {
analytics.track('acquire item', analyticsData);
}
return typeof cb === 'function' ? cb(null, _.pick(user, splitWhitespace('items balance'))) : void 0;
return typeof cb === "function" ? cb(null, _.pick(user, splitWhitespace('items balance'))) : void 0;
};