Comparing version 0.2.0 to 0.3.0
@@ -18,3 +18,9 @@ /** | ||
function weCareAbout(val) { | ||
return null !== val && (Array.isArray(val) || (typeof val === "object")); | ||
return null !== val && | ||
(Array.isArray(val) || | ||
// 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. | ||
(typeof val === "object" && val.constructor === Object)); | ||
} | ||
@@ -21,0 +27,0 @@ // for testing |
@@ -269,4 +269,4 @@ /* jshint elision:true */ | ||
}); | ||
it("should care about dates", function () { | ||
expect(i._weCareAbout([])).to.equal(true); | ||
it("should not care about dates", function () { | ||
expect(i._weCareAbout(new Date())).to.equal(false); | ||
}); | ||
@@ -273,0 +273,0 @@ it("should not care about null", function () { |
{ | ||
"name": "icepick", | ||
"version": "0.2.0", | ||
"version": "0.3.0", | ||
"description": "Utilities for working with frozen objects", | ||
@@ -5,0 +5,0 @@ "main": "icepick.js", |
@@ -33,3 +33,3 @@ # icepick [![Build Status via Travis CI](https://travis-ci.org/aearly/icepick.svg?branch=master)](https://travis-ci.org/aearly/icepick) [![NPM version](http://img.shields.io/npm/v/icepick.svg)](https://www.npmjs.org/package/icepick) | ||
Recursively freeze a collection and all its child collections with `Object.freeze()`. Values that are not Arrays or Objects will be ignored. Does not allow reference cycles. | ||
Recursively freeze a collection and all its child collections with `Object.freeze()`. Values that are not plain Arrays or Objects will be ignored, including objects created with custom constructors (e.g. `new MyClass()`). Does not allow reference cycles. | ||
@@ -36,0 +36,0 @@ ```javascript |
23810
420