v3: fix cron middleware, remove unused code from shared

This commit is contained in:
Matteo Pagliazzi
2016-04-08 11:56:51 +02:00
parent 5a259e7a25
commit 276cbc58bb
27 changed files with 49 additions and 555 deletions

View File

@@ -1,12 +1,14 @@
import dotSet from '../libs/dotSet';
import _ from 'lodash';
/*
This allows you to set object properties by dot-path. Eg, you can run pathSet('stats.hp',50,user) which is the same as
user.stats.hp = 50. This is useful because in our habitrpg-shared functions we're returning changesets as {path:value},
so that different consumers can implement setters their own way. Derby needs model.set(path, value) for example, where
Angular sets object properties directly - in which case, this function will be used.
*/
This allows you to set object properties by dot-path. Eg, you can run pathSet('stats.hp',50,user) which is the same as
user.stats.hp = 50. This is useful because in our habitrpg-shared functions we're returning changesets as {path:value},
so that different consumers can implement setters their own way. Derby needs model.set(path, value) for example, where
Angular sets object properties directly - in which case, this function will be used.
*/
module.exports = function(user, path, val) {
return dotSet(user, path, val);
// TODO use directly _.set and remove this fn
module.exports = function dotSet (user, path, val) {
return _.set(user, path, val);
};