smart-setter
Advanced tools
Comparing version 1.0.11 to 1.0.12
@@ -43,2 +43,26 @@ 'use strict'; | ||
var fillWhereTargetNotPresent = function fillWhereTargetNotPresent(config) { | ||
return function (source) { | ||
if (config.isArrayOrList(source)) { | ||
return source.map(fillWhereTargetNotPresent(config)); | ||
} else if (!config.isObjectOrMap(source)) { | ||
return source; | ||
} else { | ||
var keys = config.getKeys(source); | ||
if (keys) { | ||
return keys.reduce(function (acc, key) { | ||
var value = config.get(source, key); | ||
if (key === '_replace') { | ||
return config.merge(acc, fillWhereTargetNotPresent(config)(value)); | ||
} else { | ||
return config.set(acc, key, fillWhereTargetNotPresent(config)(value)); | ||
} | ||
}, config.emptyObjectOrMap()); | ||
} else { | ||
return source; | ||
} | ||
} | ||
}; | ||
}; | ||
var helper = function helper(config) { | ||
@@ -51,3 +75,3 @@ return function (source) { | ||
if (!config.isObjectOrMap(source)) return source; | ||
if (target === null || target === undefined) return source; | ||
if (target === null || target === undefined) return fillWhereTargetNotPresent(config)(source); | ||
return config.getKeys(source).reduce(function (acc, key) { | ||
@@ -54,0 +78,0 @@ var _ret = function () { |
{ | ||
"name": "smart-setter", | ||
"version": "1.0.11", | ||
"version": "1.0.12", | ||
"description": "create new object based on old object and set of modifications that can be applied at selective depths", | ||
@@ -42,4 +42,5 @@ "main": "index.js", | ||
"mocha": "^3.0.2", | ||
"object-config-for-smart-setter": "" | ||
} | ||
"object-config-for-smart-setter": "^1.0.11" | ||
}, | ||
"dependencies": {} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8625
155