extendable-immutable
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -8,3 +8,4 @@ import _typeof from 'babel-runtime/helpers/typeof'; | ||
var emptySymbol = 'empty'; | ||
var unwrappedMethods = ['constructor', 'get', 'getIn', 'first', 'last', 'reduce', 'reduceRight', 'find', 'findLast', 'findEntry', 'findLastEntry', 'max', 'maxBy', 'min', 'minBy']; | ||
var unwrappedMethods = ['constructor', 'get', 'getIn', 'first', 'last', 'reduce', 'reduceRight', 'find', 'findLast', 'findEntry', 'findLastEntry', 'max', 'maxBy', 'min', 'minBy', 'clear' // Important! We're manually overriding this method | ||
]; | ||
@@ -18,2 +19,7 @@ export default function createExtendable(base, copy, empty) { | ||
// Overrides the original clear method that returns an empty object | ||
proto.clear = function clear() { | ||
return this.__wrapImmutable({}); | ||
}; | ||
// A method for wrapping an immutable object, with reference equality for empty objects | ||
@@ -20,0 +26,0 @@ proto.__wrapImmutable = function __wrapImmutable(val) { |
@@ -32,3 +32,4 @@ 'use strict'; | ||
var emptySymbol = 'empty'; | ||
var unwrappedMethods = ['constructor', 'get', 'getIn', 'first', 'last', 'reduce', 'reduceRight', 'find', 'findLast', 'findEntry', 'findLastEntry', 'max', 'maxBy', 'min', 'minBy']; | ||
var unwrappedMethods = ['constructor', 'get', 'getIn', 'first', 'last', 'reduce', 'reduceRight', 'find', 'findLast', 'findEntry', 'findLastEntry', 'max', 'maxBy', 'min', 'minBy', 'clear' // Important! We're manually overriding this method | ||
]; | ||
@@ -42,2 +43,7 @@ function createExtendable(base, copy, empty) { | ||
// Overrides the original clear method that returns an empty object | ||
proto.clear = function clear() { | ||
return this.__wrapImmutable({}); | ||
}; | ||
// A method for wrapping an immutable object, with reference equality for empty objects | ||
@@ -44,0 +50,0 @@ proto.__wrapImmutable = function __wrapImmutable(val) { |
{ | ||
"name": "extendable-immutable", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"main": "lib/index.js", | ||
@@ -13,2 +13,3 @@ "jsnext:main": "es/index.js", | ||
"scripts": { | ||
"perf": "node scripts/bench.js", | ||
"test": "BABEL_ENV=commonjs mocha --compilers js:babel-register --recursive", | ||
@@ -61,5 +62,7 @@ "test:watch": "npm test -- --watch", | ||
"expect": "^1.20.2", | ||
"glob": "^7.0.5", | ||
"immutable": "^3.8.1", | ||
"mocha": "^3.0.0", | ||
"nyc": "^7.0.0" | ||
"nyc": "^7.0.0", | ||
"pretty-time": "^0.2.0" | ||
}, | ||
@@ -66,0 +69,0 @@ "peerDependencies": { |
@@ -20,3 +20,4 @@ import invariant from 'invariant' | ||
'min', | ||
'minBy' | ||
'minBy', | ||
'clear' // Important! We're manually overriding this method | ||
] | ||
@@ -33,2 +34,7 @@ | ||
// Overrides the original clear method that returns an empty object | ||
proto.clear = function clear() { | ||
return this.__wrapImmutable({}) | ||
} | ||
// A method for wrapping an immutable object, with reference equality for empty objects | ||
@@ -35,0 +41,0 @@ proto.__wrapImmutable = function __wrapImmutable(val, forceCreation = false) { |
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
32297
544
17