chore(dependency): Upgrade lodash from v2 to v3

This commit is contained in:
Blade Barringer
2015-12-26 08:18:58 -06:00
parent 33714b4947
commit b3050e5a67
15 changed files with 31 additions and 31 deletions

View File

@@ -9,7 +9,7 @@ function beastMasterProgress (pets) {
_(DROP_ANIMALS).each((animal) => {
if (pets[animal] > 0 || pets[animal] === -1)
count++;
});
}).value();
return count;
}
@@ -20,7 +20,7 @@ function dropPetsCurrentlyOwned (pets) {
_(DROP_ANIMALS).each((animal) => {
if (pets[animal] > 0)
count++;
});
}).value();
return count;
}
@@ -31,7 +31,7 @@ function mountMasterProgress (mounts) {
_(DROP_ANIMALS).each((animal) => {
if (mounts[animal])
count++;
});
}).value();
return count;
}

View File

@@ -37,7 +37,7 @@ function t (stringName) {
if (string) {
try {
return _.template(string, clonedVars);
return _.template(string)(clonedVars);
} catch (_error) {
return 'Error processing the string. Please see Help > Report a Bug.';
}
@@ -51,7 +51,7 @@ function t (stringName) {
}
try {
return _.template(stringNotFound, {
return _.template(stringNotFound)({
string: stringName,
});
} catch (_error) {

View File

@@ -126,7 +126,7 @@ preenHistory = function(history) {
*/
api.preenTodos = function(tasks) {
return _.where(tasks, function(t) {
return _.filter(tasks, function(t) {
return !t.completed || (t.challenge && t.challenge.id) || moment(t.dateCompleted).isAfter(moment().subtract({
days: 3
}));

View File

@@ -25,7 +25,7 @@ module.exports = {
clonedVars.locale = locale;
if (string) {
try {
return _.template(string, clonedVars);
return _.template(string)(clonedVars);
} catch (_error) {
e = _error;
return 'Error processing the string. Please see Help > Report a Bug.';
@@ -37,7 +37,7 @@ module.exports = {
stringNotFound = module.exports.translations[locale] && module.exports.translations[locale].stringNotFound;
}
try {
return _.template(stringNotFound, {
return _.template(stringNotFound)({
string: stringName
});
} catch (_error) {

View File

@@ -43,7 +43,7 @@
"in-app-purchase": "^0.2.0",
"jade": "~1.11.0",
"js2xmlparser": "~0.1.2",
"lodash": "~2.4.1",
"lodash": "^3.10.1",
"lodash.camelcase": "^3.0.1",
"lodash.capitalize": "^3.0.0",
"loggly": "~1.0.8",

View File

@@ -89,7 +89,7 @@ gulp.task('transifex:malformedStrings', () => {
}
});
});
});
}).value();
if (!_.isEmpty(stringsWithMalformedInterpolations)) {
let message = 'The following strings have malformed or missing interpolations';
@@ -128,7 +128,7 @@ function eachTranslationFile(languages, cb) {
cb(null, lang, filename, parsedEnglishFile, parsedTranslationFile)
});
});
}).value();
}
function eachTranslationString(languages, cb) {
@@ -162,7 +162,7 @@ function getStringsWith(json, interpolationRegex) {
var match = value.match(interpolationRegex);
if(match) strings[file_name][key] = match;
});
});
}).value();
return strings;
}

View File

@@ -54,7 +54,7 @@ describe("Coupons", function() {
expect(coupons.length).to.equal(10);
_(coupons).each(function(c) {
return expect(c.event).to.equal('wondercon');
});
}).value();
return done();
});
});
@@ -90,7 +90,7 @@ describe("Coupons", function() {
expect(codes).to.contain('code');
_(coupons).each(function(c) {
return expect(codes).to.contain(c._id);
});
}).value();
return done();
});
});
@@ -106,10 +106,10 @@ describe("Coupons", function() {
secondHalf = sortedCoupons.slice(5, 10);
_(firstHalf).each(function(c) {
return expect(codes).to.contain(c._id);
});
}).value();
_(secondHalf).each(function(c) {
return expect(codes).to.not.contain(c._id);
});
}).value();
return done();
});
});
@@ -125,10 +125,10 @@ describe("Coupons", function() {
secondHalf = sortedCoupons.slice(5, 10);
_(firstHalf).each(function(c) {
return expect(codes).to.not.contain(c._id);
});
}).value();
_(secondHalf).each(function(c) {
return expect(codes).to.contain(c._id);
});
}).value();
return done();
});
});
@@ -159,7 +159,7 @@ describe("Coupons", function() {
} else {
return expect(gear[i]).to.not.exist;
}
});
}).value();
};
beforeEach(function(done) {
return registerNewUser(function() {

View File

@@ -160,8 +160,8 @@ describe('user.fns.buy', () => {
let armoireKey = gearObject.key;
fullArmoire[armoireKey] = true;
});
});
}).value();
}).value();
beforeEach(() => {
user.achievements.ultimateGearSets = { rogue: true };

View File

@@ -83,7 +83,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
_(clonedTasks).each(function(val, type) {
challenge[type + 's'].forEach(_cloneTaskAndPush);
});
}).value();
$scope.obj = $scope.newChallenge = new Challenges.Challenge({
name: challenge.name,

View File

@@ -184,7 +184,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
}
_.each(chapters, function(chapter, k){
_(chapter).flatten().each(function(step, i) {
_(chapter).flattenDeep().each(function(step, i) {
step.content = "<div><div class='" + (env.worldDmg.guide ? "npc_justin_broken" : "npc_justin") + " float-left'></div>" + step.content + "</div>";
$(step.element).popover('destroy'); // destroy existing hover popovers so we can add our own
step.onShow = function(){
@@ -209,7 +209,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
}
User.set(ups);
}
})
}).value();
});
var tour = {};
@@ -226,7 +226,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
'<h3 class="popover-title"></h3>' +
'<div class="popover-content"></div>' +
'<div class="popover-navigation"> ' +
(showCounter ? '<span style="float:right;">'+ (i+1 +' of '+ _.flatten(chapters[k]).length) +'</span>' : '')+ // counter
(showCounter ? '<span style="float:right;">'+ (i+1 +' of '+ _.flattenDeep(chapters[k]).length) +'</span>' : '')+ // counter
'<div class="btn-group">' +
(step.hideNavigation ? '' : '<button class="btn btn-sm btn-default" data-role="prev">&laquo; Previous</button>') +
(showFinish ? ('<button class="btn btn-sm btn-primary" data-role="end" style="float:none;">' + (step.proceed ? step.proceed : "Finish Tour") + '</button>') :

View File

@@ -48,7 +48,7 @@
total += equipmentStat;
}
});
}).value();
return total;
}

View File

@@ -36,7 +36,7 @@
_(cleansedTask.checklist).forEach(function(item) {
item.completed = false;
item.id = Shared.uuid();
});
}).value();
if (cleansedTask.type !== 'reward') {
delete cleansedTask.value;

View File

@@ -59,7 +59,7 @@ exports.createSubscription = function(data, cb) {
}).defaults({ // allow non-override if a plan was previously used
dateCreated: new Date(),
mysteryItems: []
});
}).value();
}
// Block sub perks

View File

@@ -59,7 +59,7 @@ function _generateLabelForGoogleAnalytics(data) {
label = data[key];
return false; // exit _.each early
}
});
}).value();
return label;
}
@@ -73,7 +73,7 @@ function _generateValueForGoogleAnalytics(data) {
value = data[key];
return false; // exit _.each early
}
});
}).value();
return value;
}

View File

@@ -4,7 +4,7 @@ mixin gemCost(cost)
= ' ' + env.t('locked')
block
-var gearGroup = function(grouping) { return env._(env.Content.gear.flat).where({gearSet:grouping}).pluck('key') }
-var gearGroup = function(grouping) { return env._(env.Content.gear.flat).where({gearSet:grouping}).pluck('key').value() }
-var showPath = function(path, items, joiner) { return path+'["'+items.join('"] '+joiner+' '+path+'["')+'"]'; }
-var unlockPath = function(path, items) { return 'unlock("'+path+'.'+items.join(','+path+'.')+'")'; }