mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 06:37:23 +01:00
chore(dependency): Upgrade lodash from v2 to v3
This commit is contained in:
@@ -9,7 +9,7 @@ function beastMasterProgress (pets) {
|
|||||||
_(DROP_ANIMALS).each((animal) => {
|
_(DROP_ANIMALS).each((animal) => {
|
||||||
if (pets[animal] > 0 || pets[animal] === -1)
|
if (pets[animal] > 0 || pets[animal] === -1)
|
||||||
count++;
|
count++;
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -20,7 +20,7 @@ function dropPetsCurrentlyOwned (pets) {
|
|||||||
_(DROP_ANIMALS).each((animal) => {
|
_(DROP_ANIMALS).each((animal) => {
|
||||||
if (pets[animal] > 0)
|
if (pets[animal] > 0)
|
||||||
count++;
|
count++;
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
@@ -31,7 +31,7 @@ function mountMasterProgress (mounts) {
|
|||||||
_(DROP_ANIMALS).each((animal) => {
|
_(DROP_ANIMALS).each((animal) => {
|
||||||
if (mounts[animal])
|
if (mounts[animal])
|
||||||
count++;
|
count++;
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ function t (stringName) {
|
|||||||
|
|
||||||
if (string) {
|
if (string) {
|
||||||
try {
|
try {
|
||||||
return _.template(string, clonedVars);
|
return _.template(string)(clonedVars);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
return 'Error processing the string. Please see Help > Report a Bug.';
|
return 'Error processing the string. Please see Help > Report a Bug.';
|
||||||
}
|
}
|
||||||
@@ -51,7 +51,7 @@ function t (stringName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
return _.template(stringNotFound, {
|
return _.template(stringNotFound)({
|
||||||
string: stringName,
|
string: stringName,
|
||||||
});
|
});
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ preenHistory = function(history) {
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
api.preenTodos = function(tasks) {
|
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({
|
return !t.completed || (t.challenge && t.challenge.id) || moment(t.dateCompleted).isAfter(moment().subtract({
|
||||||
days: 3
|
days: 3
|
||||||
}));
|
}));
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module.exports = {
|
|||||||
clonedVars.locale = locale;
|
clonedVars.locale = locale;
|
||||||
if (string) {
|
if (string) {
|
||||||
try {
|
try {
|
||||||
return _.template(string, clonedVars);
|
return _.template(string)(clonedVars);
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
e = _error;
|
e = _error;
|
||||||
return 'Error processing the string. Please see Help > Report a Bug.';
|
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;
|
stringNotFound = module.exports.translations[locale] && module.exports.translations[locale].stringNotFound;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return _.template(stringNotFound, {
|
return _.template(stringNotFound)({
|
||||||
string: stringName
|
string: stringName
|
||||||
});
|
});
|
||||||
} catch (_error) {
|
} catch (_error) {
|
||||||
|
|||||||
@@ -43,7 +43,7 @@
|
|||||||
"in-app-purchase": "^0.2.0",
|
"in-app-purchase": "^0.2.0",
|
||||||
"jade": "~1.11.0",
|
"jade": "~1.11.0",
|
||||||
"js2xmlparser": "~0.1.2",
|
"js2xmlparser": "~0.1.2",
|
||||||
"lodash": "~2.4.1",
|
"lodash": "^3.10.1",
|
||||||
"lodash.camelcase": "^3.0.1",
|
"lodash.camelcase": "^3.0.1",
|
||||||
"lodash.capitalize": "^3.0.0",
|
"lodash.capitalize": "^3.0.0",
|
||||||
"loggly": "~1.0.8",
|
"loggly": "~1.0.8",
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ gulp.task('transifex:malformedStrings', () => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
if (!_.isEmpty(stringsWithMalformedInterpolations)) {
|
if (!_.isEmpty(stringsWithMalformedInterpolations)) {
|
||||||
let message = 'The following strings have malformed or missing interpolations';
|
let message = 'The following strings have malformed or missing interpolations';
|
||||||
@@ -128,7 +128,7 @@ function eachTranslationFile(languages, cb) {
|
|||||||
|
|
||||||
cb(null, lang, filename, parsedEnglishFile, parsedTranslationFile)
|
cb(null, lang, filename, parsedEnglishFile, parsedTranslationFile)
|
||||||
});
|
});
|
||||||
});
|
}).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
function eachTranslationString(languages, cb) {
|
function eachTranslationString(languages, cb) {
|
||||||
@@ -162,7 +162,7 @@ function getStringsWith(json, interpolationRegex) {
|
|||||||
var match = value.match(interpolationRegex);
|
var match = value.match(interpolationRegex);
|
||||||
if(match) strings[file_name][key] = match;
|
if(match) strings[file_name][key] = match;
|
||||||
});
|
});
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return strings;
|
return strings;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ describe("Coupons", function() {
|
|||||||
expect(coupons.length).to.equal(10);
|
expect(coupons.length).to.equal(10);
|
||||||
_(coupons).each(function(c) {
|
_(coupons).each(function(c) {
|
||||||
return expect(c.event).to.equal('wondercon');
|
return expect(c.event).to.equal('wondercon');
|
||||||
});
|
}).value();
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -90,7 +90,7 @@ describe("Coupons", function() {
|
|||||||
expect(codes).to.contain('code');
|
expect(codes).to.contain('code');
|
||||||
_(coupons).each(function(c) {
|
_(coupons).each(function(c) {
|
||||||
return expect(codes).to.contain(c._id);
|
return expect(codes).to.contain(c._id);
|
||||||
});
|
}).value();
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -106,10 +106,10 @@ describe("Coupons", function() {
|
|||||||
secondHalf = sortedCoupons.slice(5, 10);
|
secondHalf = sortedCoupons.slice(5, 10);
|
||||||
_(firstHalf).each(function(c) {
|
_(firstHalf).each(function(c) {
|
||||||
return expect(codes).to.contain(c._id);
|
return expect(codes).to.contain(c._id);
|
||||||
});
|
}).value();
|
||||||
_(secondHalf).each(function(c) {
|
_(secondHalf).each(function(c) {
|
||||||
return expect(codes).to.not.contain(c._id);
|
return expect(codes).to.not.contain(c._id);
|
||||||
});
|
}).value();
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -125,10 +125,10 @@ describe("Coupons", function() {
|
|||||||
secondHalf = sortedCoupons.slice(5, 10);
|
secondHalf = sortedCoupons.slice(5, 10);
|
||||||
_(firstHalf).each(function(c) {
|
_(firstHalf).each(function(c) {
|
||||||
return expect(codes).to.not.contain(c._id);
|
return expect(codes).to.not.contain(c._id);
|
||||||
});
|
}).value();
|
||||||
_(secondHalf).each(function(c) {
|
_(secondHalf).each(function(c) {
|
||||||
return expect(codes).to.contain(c._id);
|
return expect(codes).to.contain(c._id);
|
||||||
});
|
}).value();
|
||||||
return done();
|
return done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -159,7 +159,7 @@ describe("Coupons", function() {
|
|||||||
} else {
|
} else {
|
||||||
return expect(gear[i]).to.not.exist;
|
return expect(gear[i]).to.not.exist;
|
||||||
}
|
}
|
||||||
});
|
}).value();
|
||||||
};
|
};
|
||||||
beforeEach(function(done) {
|
beforeEach(function(done) {
|
||||||
return registerNewUser(function() {
|
return registerNewUser(function() {
|
||||||
|
|||||||
@@ -160,8 +160,8 @@ describe('user.fns.buy', () => {
|
|||||||
let armoireKey = gearObject.key;
|
let armoireKey = gearObject.key;
|
||||||
|
|
||||||
fullArmoire[armoireKey] = true;
|
fullArmoire[armoireKey] = true;
|
||||||
});
|
}).value();
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
user.achievements.ultimateGearSets = { rogue: true };
|
user.achievements.ultimateGearSets = { rogue: true };
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ habitrpg.controller("ChallengesCtrl", ['$rootScope','$scope', 'Shared', 'User',
|
|||||||
|
|
||||||
_(clonedTasks).each(function(val, type) {
|
_(clonedTasks).each(function(val, type) {
|
||||||
challenge[type + 's'].forEach(_cloneTaskAndPush);
|
challenge[type + 's'].forEach(_cloneTaskAndPush);
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
$scope.obj = $scope.newChallenge = new Challenges.Challenge({
|
$scope.obj = $scope.newChallenge = new Challenges.Challenge({
|
||||||
name: challenge.name,
|
name: challenge.name,
|
||||||
|
|||||||
@@ -184,7 +184,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
_.each(chapters, function(chapter, k){
|
_.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.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.element).popover('destroy'); // destroy existing hover popovers so we can add our own
|
||||||
step.onShow = function(){
|
step.onShow = function(){
|
||||||
@@ -209,7 +209,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
}
|
}
|
||||||
User.set(ups);
|
User.set(ups);
|
||||||
}
|
}
|
||||||
})
|
}).value();
|
||||||
});
|
});
|
||||||
|
|
||||||
var tour = {};
|
var tour = {};
|
||||||
@@ -226,7 +226,7 @@ function($rootScope, User, $timeout, $state, Analytics) {
|
|||||||
'<h3 class="popover-title"></h3>' +
|
'<h3 class="popover-title"></h3>' +
|
||||||
'<div class="popover-content"></div>' +
|
'<div class="popover-content"></div>' +
|
||||||
'<div class="popover-navigation"> ' +
|
'<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">' +
|
'<div class="btn-group">' +
|
||||||
(step.hideNavigation ? '' : '<button class="btn btn-sm btn-default" data-role="prev">« Previous</button>') +
|
(step.hideNavigation ? '' : '<button class="btn btn-sm btn-default" data-role="prev">« Previous</button>') +
|
||||||
(showFinish ? ('<button class="btn btn-sm btn-primary" data-role="end" style="float:none;">' + (step.proceed ? step.proceed : "Finish Tour") + '</button>') :
|
(showFinish ? ('<button class="btn btn-sm btn-primary" data-role="end" style="float:none;">' + (step.proceed ? step.proceed : "Finish Tour") + '</button>') :
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
|
|
||||||
total += equipmentStat;
|
total += equipmentStat;
|
||||||
}
|
}
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return total;
|
return total;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@
|
|||||||
_(cleansedTask.checklist).forEach(function(item) {
|
_(cleansedTask.checklist).forEach(function(item) {
|
||||||
item.completed = false;
|
item.completed = false;
|
||||||
item.id = Shared.uuid();
|
item.id = Shared.uuid();
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
if (cleansedTask.type !== 'reward') {
|
if (cleansedTask.type !== 'reward') {
|
||||||
delete cleansedTask.value;
|
delete cleansedTask.value;
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ exports.createSubscription = function(data, cb) {
|
|||||||
}).defaults({ // allow non-override if a plan was previously used
|
}).defaults({ // allow non-override if a plan was previously used
|
||||||
dateCreated: new Date(),
|
dateCreated: new Date(),
|
||||||
mysteryItems: []
|
mysteryItems: []
|
||||||
});
|
}).value();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block sub perks
|
// Block sub perks
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ function _generateLabelForGoogleAnalytics(data) {
|
|||||||
label = data[key];
|
label = data[key];
|
||||||
return false; // exit _.each early
|
return false; // exit _.each early
|
||||||
}
|
}
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return label;
|
return label;
|
||||||
}
|
}
|
||||||
@@ -73,7 +73,7 @@ function _generateValueForGoogleAnalytics(data) {
|
|||||||
value = data[key];
|
value = data[key];
|
||||||
return false; // exit _.each early
|
return false; // exit _.each early
|
||||||
}
|
}
|
||||||
});
|
}).value();
|
||||||
|
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ mixin gemCost(cost)
|
|||||||
= ' ' + env.t('locked')
|
= ' ' + env.t('locked')
|
||||||
block
|
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 showPath = function(path, items, joiner) { return path+'["'+items.join('"] '+joiner+' '+path+'["')+'"]'; }
|
||||||
-var unlockPath = function(path, items) { return 'unlock("'+path+'.'+items.join(','+path+'.')+'")'; }
|
-var unlockPath = function(path, items) { return 'unlock("'+path+'.'+items.join(','+path+'.')+'")'; }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user