clone
Advanced tools
Comparing version 0.0.7 to 0.1.0
module.exports = clone; | ||
/** | ||
* Clones an Object using deep cloning. | ||
* Clones (copies) an Object using deep copying. | ||
* | ||
@@ -64,3 +64,3 @@ * This function supports circular references by default, but if you are certain | ||
else | ||
child = parent; //Just a simple shallow clone will do | ||
child = parent; //Just a simple shallow copy will do | ||
return child; | ||
@@ -108,1 +108,4 @@ } | ||
} | ||
// see: clonePrototype.js | ||
clone.clonePrototype = require('./clonePrototype.js'); |
@@ -11,3 +11,3 @@ { | ||
], | ||
"version": "0.0.7", | ||
"version": "0.1.0", | ||
"repository": { | ||
@@ -41,2 +41,2 @@ "type": "git", | ||
} | ||
} | ||
} |
21
test.js
@@ -124,3 +124,3 @@ if(module.parent === null) { | ||
_(aCopy.c[0] == a.c[0]); | ||
//console.log(util.inspect(aCopy, true, null) ); | ||
@@ -143,1 +143,20 @@ //console.log("------------------------------------------------------------"); | ||
}; | ||
exports['clonePrototype'] = function(test) { | ||
test.expect(3); // how many tests? | ||
var a = { | ||
a: "aaa", | ||
x: 123, | ||
y: 45.65 | ||
}; | ||
var b = clone.clonePrototype(a); | ||
test.strictEqual(b.a, a.a); | ||
test.strictEqual(b.x, a.x); | ||
test.strictEqual(b.y, a.y); | ||
test.done(); | ||
} |
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
11358
7
229
91
1