Use 'Object.values' and 'Object.keys' instead of '_.each(object)'

This commit is contained in:
Hongarc 2018-12-01 12:33:23 +07:00
parent bd8009386d
commit 96ddb5041a
9 changed files with 52 additions and 33 deletions

View file

@ -82,7 +82,8 @@ var Command = Backbone.Model.extend({
return this.replaceDotWithHead(arg);
}, this);
var newMap = {};
_.each(options, function(args, key) {
Object.keys(options).forEach(function(key) {
var args = options[key];
newMap[key] = Object.values(args).map(function (arg) {
return this.replaceDotWithHead(arg);
}, this);
@ -273,7 +274,8 @@ var Command = Backbone.Model.extend({
return false;
}
_.each(results.toSet, function(obj, key) {
Object.keys(results.toSet).forEach(function(key) {
var obj = results.toSet[key];
// data comes back from the parsing functions like
// options (etc) that need to be set
this.set(key, obj);