diff options
Diffstat (limited to 'bin/wiki/ImportarDesdeURL/node_modules/map-values-deep/index.js')
-rw-r--r-- | bin/wiki/ImportarDesdeURL/node_modules/map-values-deep/index.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/bin/wiki/ImportarDesdeURL/node_modules/map-values-deep/index.js b/bin/wiki/ImportarDesdeURL/node_modules/map-values-deep/index.js new file mode 100644 index 00000000..d023a9ea --- /dev/null +++ b/bin/wiki/ImportarDesdeURL/node_modules/map-values-deep/index.js @@ -0,0 +1,14 @@ +'use strict' + +const { map, isArray, isObject, isPlainObject, mapValues } = require('lodash') + +const mapValuesDeep = (obj, fn, key) => + isArray(obj) + ? map(obj, (innerObj, idx) => mapValuesDeep(innerObj, fn, idx)) + : isPlainObject(obj) + ? mapValues(obj, (val, key) => mapValuesDeep(val, fn, key)) + : isObject(obj) + ? obj + : fn(obj, key) + +module.exports = mapValuesDeep |