Comparing version 0.3.1 to 0.3.2
21
index.js
@@ -54,4 +54,23 @@ module.exports = Traverse; | ||
if (typeof src === 'object' && src !== null) { | ||
var dst = Array.isArray(src) ? [] : Object.create(src.__proto__); | ||
var dst; | ||
if (Array.isArray(src)) { | ||
dst = []; | ||
} | ||
else if (src instanceof Date) { | ||
dst = new Date(src); | ||
} | ||
else if (src instanceof Boolean) { | ||
dst = new Boolean(src); | ||
} | ||
else if (src instanceof Number) { | ||
dst = new Number(src); | ||
} | ||
else if (src instanceof String) { | ||
dst = new String(src); | ||
} | ||
else { | ||
dst = Object.create(src.__proto__); | ||
} | ||
parents.push(src); | ||
@@ -58,0 +77,0 @@ nodes.push(dst); |
{ | ||
"name" : "traverse", | ||
"version" : "0.3.1", | ||
"version" : "0.3.2", | ||
"description" : "Traverse and transform objects by visiting every node on a recursive walk", | ||
@@ -5,0 +5,0 @@ "author" : "James Halliday", |
Sorry, the diff of this file is not supported yet
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
22887
19
564
185