Comparing version 1.1.0 to 1.1.1
@@ -41,4 +41,11 @@ // Load modules | ||
var newObj = (obj instanceof Array ? [] : {}); | ||
var create = function (obj) { | ||
var o = {}; | ||
o.__proto__ = Object.getPrototypeOf(obj); | ||
return o; | ||
}; | ||
var newObj = (obj instanceof Array ? [] : create(obj)); | ||
seen.orig.push(obj); | ||
@@ -45,0 +52,0 @@ seen.copy.push(newObj); |
{ | ||
"name": "hoek", | ||
"description": "General purpose node utilities", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": "git://github.com/spumko/hoek", | ||
@@ -6,0 +6,0 @@ "main": "index", |
@@ -0,0 +0,0 @@ <a href="https://github.com/spumko"><img src="https://raw.github.com/spumko/spumko/master/images/from.png" align="right" /></a> |
@@ -202,2 +202,20 @@ // Load modules | ||
}); | ||
it('should clone an object with a prototype', function (done) { | ||
var Obj = function () { | ||
this.a = 5; | ||
}; | ||
Obj.prototype.b = function () { return 'c'; }; | ||
var a = new Obj(); | ||
var b = Hoek.clone(a); | ||
expect(b.a).to.equal(5); | ||
expect(b.b()).to.equal('c'); | ||
expect(a).to.deep.equal(b); | ||
done(); | ||
}); | ||
}); | ||
@@ -204,0 +222,0 @@ |
Sorry, the diff of this file is not supported yet
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
103073
1401