extendable-immutable
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -1,4 +0,4 @@ | ||
import _Object$assign from "babel-runtime/core-js/object/assign"; | ||
import _getIterator from "babel-runtime/core-js/get-iterator"; | ||
import _Object$keys from "babel-runtime/core-js/object/keys"; | ||
import _Object$assign from 'babel-runtime/core-js/object/assign'; | ||
import _getIterator from 'babel-runtime/core-js/get-iterator'; | ||
import _Object$keys from 'babel-runtime/core-js/object/keys'; | ||
import createExtendable from './util/createExtendable'; | ||
@@ -12,9 +12,9 @@ | ||
if (emptyBase.add) { | ||
exampleBase = emptyBase.add("a"); | ||
exampleBase = emptyBase.add('a'); | ||
} else if (emptyBase.set) { | ||
exampleBase = emptyBase.set("a", "b"); | ||
exampleBase = emptyBase.set('a', 'b'); | ||
} else if (emptyBase.push) { | ||
exampleBase = emptyBase.push("a"); | ||
exampleBase = emptyBase.push('a'); | ||
} else { | ||
throw new Error("extendable: `" + NAME + "` is not supported."); | ||
throw new Error('extendable: `' + NAME + '` is not supported.'); | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -15,3 +15,4 @@ import _typeof from 'babel-runtime/helpers/typeof'; | ||
var name = base.prototype.constructor.name; | ||
var constructor = base.prototype.constructor; | ||
var name = constructor.name; | ||
var proto = _Object$create(base.prototype); | ||
@@ -32,5 +33,5 @@ | ||
if (!forceCreation && !val.size && !val.__ownerID) { | ||
if (!val.size && !val.__ownerID && !forceCreation) { | ||
if (!constructor[emptySymbol] || searchParentConstructorEntry(constructor, emptySymbol, constructor[emptySymbol])) { | ||
constructor[emptySymbol] = empty(_Object$create(prototype)); | ||
return constructor[emptySymbol] = empty(_Object$create(prototype)); | ||
} | ||
@@ -57,5 +58,5 @@ | ||
var res = _originalMethod.apply(this, args); | ||
var constructor = _Object$getPrototypeOf(res).constructor; | ||
var _constructor = void 0; | ||
if (res && (typeof res === 'undefined' ? 'undefined' : _typeof(res)) === 'object' && constructor === base.prototype.constructor) { | ||
if (res && (typeof res === 'undefined' ? 'undefined' : _typeof(res)) === 'object' && (_constructor = _Object$getPrototypeOf(res).constructor) === constructor) { | ||
return this.__wrapImmutable(res); | ||
@@ -62,0 +63,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict"; | ||
'use strict'; | ||
@@ -7,11 +7,11 @@ Object.defineProperty(exports, "__esModule", { | ||
var _assign = require("babel-runtime/core-js/object/assign"); | ||
var _assign = require('babel-runtime/core-js/object/assign'); | ||
var _assign2 = _interopRequireDefault(_assign); | ||
var _getIterator2 = require("babel-runtime/core-js/get-iterator"); | ||
var _getIterator2 = require('babel-runtime/core-js/get-iterator'); | ||
var _getIterator3 = _interopRequireDefault(_getIterator2); | ||
var _keys = require("babel-runtime/core-js/object/keys"); | ||
var _keys = require('babel-runtime/core-js/object/keys'); | ||
@@ -22,3 +22,3 @@ var _keys2 = _interopRequireDefault(_keys); | ||
var _createExtendable = require("./util/createExtendable"); | ||
var _createExtendable = require('./util/createExtendable'); | ||
@@ -35,9 +35,9 @@ var _createExtendable2 = _interopRequireDefault(_createExtendable); | ||
if (emptyBase.add) { | ||
exampleBase = emptyBase.add("a"); | ||
exampleBase = emptyBase.add('a'); | ||
} else if (emptyBase.set) { | ||
exampleBase = emptyBase.set("a", "b"); | ||
exampleBase = emptyBase.set('a', 'b'); | ||
} else if (emptyBase.push) { | ||
exampleBase = emptyBase.push("a"); | ||
exampleBase = emptyBase.push('a'); | ||
} else { | ||
throw new Error("extendable: `" + NAME + "` is not supported."); | ||
throw new Error('extendable: `' + NAME + '` is not supported.'); | ||
} | ||
@@ -44,0 +44,0 @@ |
@@ -39,3 +39,4 @@ 'use strict'; | ||
var name = base.prototype.constructor.name; | ||
var constructor = base.prototype.constructor; | ||
var name = constructor.name; | ||
var proto = (0, _create2.default)(base.prototype); | ||
@@ -56,5 +57,5 @@ | ||
if (!forceCreation && !val.size && !val.__ownerID) { | ||
if (!val.size && !val.__ownerID && !forceCreation) { | ||
if (!constructor[emptySymbol] || (0, _searchParentConstructorEntry2.default)(constructor, emptySymbol, constructor[emptySymbol])) { | ||
constructor[emptySymbol] = empty((0, _create2.default)(prototype)); | ||
return constructor[emptySymbol] = empty((0, _create2.default)(prototype)); | ||
} | ||
@@ -81,5 +82,5 @@ | ||
var res = _originalMethod.apply(this, args); | ||
var constructor = (0, _getPrototypeOf2.default)(res).constructor; | ||
var _constructor = void 0; | ||
if (res && (typeof res === 'undefined' ? 'undefined' : (0, _typeof3.default)(res)) === 'object' && constructor === base.prototype.constructor) { | ||
if (res && (typeof res === 'undefined' ? 'undefined' : (0, _typeof3.default)(res)) === 'object' && (_constructor = (0, _getPrototypeOf2.default)(res).constructor) === constructor) { | ||
return this.__wrapImmutable(res); | ||
@@ -86,0 +87,0 @@ } |
{ | ||
"name": "extendable-immutable", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"main": "lib/index.js", | ||
@@ -56,6 +56,6 @@ "jsnext:main": "es/index.js", | ||
"coveralls": "^2.11.11", | ||
"eslint": "^3.0.1", | ||
"eslint-config-excellence": "^1.13.0", | ||
"eslint": "^3.5.0", | ||
"eslint-config-excellence": "^1.14.0", | ||
"eslint-plugin-mocha": "^4.1.0", | ||
"eslint-plugin-react": "^5.2.2", | ||
"eslint-plugin-react": "^6.3.0", | ||
"expect": "^1.20.2", | ||
@@ -62,0 +62,0 @@ "glob": "^7.0.5", |
@@ -9,7 +9,7 @@ import createExtendable from './util/createExtendable' | ||
if (emptyBase.add) { | ||
exampleBase = emptyBase.add("a") | ||
exampleBase = emptyBase.add('a') | ||
} else if (emptyBase.set) { | ||
exampleBase = emptyBase.set("a", "b") | ||
exampleBase = emptyBase.set('a', 'b') | ||
} else if (emptyBase.push) { | ||
exampleBase = emptyBase.push("a") | ||
exampleBase = emptyBase.push('a') | ||
} else { | ||
@@ -16,0 +16,0 @@ throw new Error(`extendable: \`${NAME}\` is not supported.`) |
@@ -30,3 +30,4 @@ import invariant from 'invariant' | ||
const name = base.prototype.constructor.name | ||
const constructor = base.prototype.constructor | ||
const name = constructor.name | ||
const proto = Object.create(base.prototype) | ||
@@ -44,3 +45,3 @@ | ||
if (!forceCreation && !val.size && !val.__ownerID) { | ||
if (!val.size && !val.__ownerID && !forceCreation) { | ||
if ( | ||
@@ -50,3 +51,3 @@ !constructor[emptySymbol] || | ||
) { | ||
constructor[emptySymbol] = empty(Object.create(prototype)) | ||
return constructor[emptySymbol] = empty(Object.create(prototype)) | ||
} | ||
@@ -72,5 +73,9 @@ | ||
const res = _originalMethod.apply(this, args) | ||
const constructor = Object.getPrototypeOf(res).constructor | ||
let _constructor | ||
if (res && typeof res === 'object' && constructor === base.prototype.constructor) { | ||
if ( | ||
res && | ||
typeof res === 'object' && | ||
(_constructor = Object.getPrototypeOf(res).constructor) === constructor | ||
) { | ||
return this.__wrapImmutable(res) | ||
@@ -77,0 +82,0 @@ } |
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
33373
582