Comparing version 1.0.0 to 1.1.0
@@ -20,5 +20,5 @@ /** | ||
// This will skip objects created with `new Foo()` | ||
// but not objects created with `Object.create(proto)` | ||
// The benefit is ignoring DOM elements, which are often | ||
// circular. | ||
// and objects created with `Object.create(proto)` | ||
// The benefit is ignoring DOM elements and event emitters, | ||
// which are often circular. | ||
isObjectLike(val)); | ||
@@ -28,3 +28,5 @@ } | ||
function isObjectLike(val) { | ||
return typeof val === "object" && val.constructor === Object; | ||
return typeof val === "object" && | ||
val.constructor === Object && | ||
Object.getPrototypeOf(val) === Object.prototype; | ||
} | ||
@@ -31,0 +33,0 @@ |
@@ -527,2 +527,4 @@ /* jshint elision:true */ | ||
describe("_weCareAbout", function () { | ||
function Foo() {} | ||
it("should care about objects", function () { | ||
@@ -541,4 +543,17 @@ expect(i._weCareAbout({})).to.equal(true); | ||
it("should not care about undefined", function () { | ||
expect(i._weCareAbout(null)).to.equal(false); | ||
expect(i._weCareAbout(undefined)).to.equal(false); | ||
}); | ||
it("should not care about class instances", function () { | ||
expect(i._weCareAbout(new Foo())).to.equal(false); | ||
}); | ||
it("should not care about objects created with Object.create()", | ||
function () { | ||
expect(i._weCareAbout(Object.create(Foo.prototype))).to.equal(false); | ||
}); | ||
it("should not care about objects created with Object.create({})", | ||
function () { | ||
expect(i._weCareAbout(Object.create({ | ||
foo: function () {} | ||
}))).to.equal(false); | ||
}); | ||
}); | ||
@@ -545,0 +560,0 @@ |
{ | ||
"name": "icepick", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"description": "Utilities for treating frozen JavaScript objects as persistent immutable collections.", | ||
@@ -5,0 +5,0 @@ "main": "icepick.js", |
Sorry, the diff of this file is not supported yet
40939
755