deep-clone-map
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -17,7 +17,2 @@ var __assign = this && this.__assign || function () { | ||
function deepCloneMap(o, cb) { | ||
if (cb === void 0) { | ||
cb = function (val) { | ||
return val; | ||
}; | ||
} | ||
if (!o || typeof o !== 'object') { | ||
@@ -38,3 +33,3 @@ return o; | ||
t(obj[key], previousKey); | ||
} else { | ||
} else if (typeof cb === 'function') { | ||
obj[key] = cb(obj[key], previousKey); | ||
@@ -41,0 +36,0 @@ } |
@@ -35,3 +35,2 @@ "use strict"; | ||
function deepCloneMap(o, cb) { | ||
if (cb === void 0) { cb = function (val) { return val; }; } | ||
if (!o || typeof o !== 'object') { | ||
@@ -51,3 +50,3 @@ return o; | ||
} | ||
else { | ||
else if (typeof cb === 'function') { | ||
obj[key] = cb(obj[key], previousKey); | ||
@@ -54,0 +53,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
function deepCloneMap(o, cb = val => val) { | ||
function deepCloneMap(o, cb) { | ||
if (!o || typeof o !== 'object') { | ||
@@ -17,3 +17,3 @@ return o; | ||
} | ||
else { | ||
else if (typeof cb === 'function') { | ||
obj[key] = cb(obj[key], previousKey); | ||
@@ -20,0 +20,0 @@ } |
@@ -5,3 +5,3 @@ type Param = object | any[] | string | number | null | ||
function deepCloneMap<T>(o: T, cb: Callback = val => val): T { | ||
function deepCloneMap<T>(o: T, cb?: Callback): T { | ||
if (!o || typeof o !== 'object') { | ||
@@ -22,3 +22,3 @@ return o | ||
t(obj[key], previousKey) | ||
} else { | ||
} else if (typeof cb === 'function') { | ||
obj[key] = cb(obj[key], previousKey) | ||
@@ -25,0 +25,0 @@ } |
{ | ||
"name": "deep-clone-map", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Deep clone and map complex nested objects", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -21,3 +21,3 @@ # Deep Clone Map | ||
<b>Deep Clone Map</b> has a performance on par with other popular alternatives, but it offers more without using any dependencies. | ||
<b>Deep Clone Map</b> has a performance on par with other popular alternatives, but it doesn't use any dependencies, and in some instances provides more functionality. | ||
@@ -24,0 +24,0 @@ Some <b>benchmarks</b> running on MacOS Catalina and Node v12.13.0 using benchmark library: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
2160561
63535