habitica/common/script/ops/allocateNow.js

11 lines
301 B
JavaScript
Raw Normal View History

2016-03-07 22:02:42 +00:00
import _ from 'lodash';
module.exports = function(user, req, cb) {
_.times(user.stats.points, user.fns.autoAllocate);
user.stats.points = 0;
if (typeof user.markModified === "function") {
user.markModified('stats');
}
return typeof cb === "function" ? cb(null, user.stats) : void 0;
};