object.assign
Advanced tools
Comparing version 4.0.4 to 4.1.0
@@ -0,1 +1,9 @@ | ||
4.0.4 / 2017-12-21 | ||
================== | ||
* [New] add `auto` entry point (#52) | ||
* [Refactor] Use `has-symbols` module | ||
* [Deps] update `function-bind`, `object-keys` | ||
* [Dev Deps] update `@es-shims/api`, `browserify`, `nsp`, `eslint`, `@ljharb/eslint-config`, `is` | ||
* [Tests] up to `node` `v9.3`, `v8.9`, `v6.12`; use `nvm install-latest-npm`; pin included builds to LTS | ||
4.0.4 / 2016-07-04 | ||
@@ -2,0 +10,0 @@ ================== |
@@ -13,48 +13,5 @@ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
},{"./":4,"object-keys":9}],2:[function(require,module,exports){ | ||
},{"./":3,"object-keys":9}],2:[function(require,module,exports){ | ||
'use strict'; | ||
var keys = require('object-keys'); | ||
module.exports = function hasSymbols() { | ||
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } | ||
if (typeof Symbol.iterator === 'symbol') { return true; } | ||
var obj = {}; | ||
var sym = Symbol('test'); | ||
var symObj = Object(sym); | ||
if (typeof sym === 'string') { return false; } | ||
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } | ||
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } | ||
// temp disabled per https://github.com/ljharb/object.assign/issues/17 | ||
// if (sym instanceof Symbol) { return false; } | ||
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 | ||
// if (!(symObj instanceof Symbol)) { return false; } | ||
var symVal = 42; | ||
obj[sym] = symVal; | ||
for (sym in obj) { return false; } | ||
if (keys(obj).length !== 0) { return false; } | ||
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } | ||
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } | ||
var syms = Object.getOwnPropertySymbols(obj); | ||
if (syms.length !== 1 || syms[0] !== sym) { return false; } | ||
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } | ||
if (typeof Object.getOwnPropertyDescriptor === 'function') { | ||
var descriptor = Object.getOwnPropertyDescriptor(obj, sym); | ||
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } | ||
} | ||
return true; | ||
}; | ||
},{"object-keys":9}],3:[function(require,module,exports){ | ||
'use strict'; | ||
// modified from https://github.com/es-shims/es6-shim | ||
@@ -66,3 +23,3 @@ var keys = require('object-keys'); | ||
}; | ||
var hasSymbols = require('./hasSymbols')(); | ||
var hasSymbols = require('has-symbols/shams')(); | ||
var toObject = Object; | ||
@@ -101,3 +58,3 @@ var push = bind.call(Function.call, Array.prototype.push); | ||
},{"./hasSymbols":2,"function-bind":8,"object-keys":9}],4:[function(require,module,exports){ | ||
},{"function-bind":7,"has-symbols/shams":8,"object-keys":9}],3:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -114,4 +71,4 @@ | ||
defineProperties(polyfill, { | ||
getPolyfill: getPolyfill, | ||
implementation: implementation, | ||
getPolyfill: getPolyfill, | ||
shim: shim | ||
@@ -122,3 +79,3 @@ }); | ||
},{"./implementation":3,"./polyfill":11,"./shim":12,"define-properties":5}],5:[function(require,module,exports){ | ||
},{"./implementation":2,"./polyfill":11,"./shim":12,"define-properties":4}],4:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -181,3 +138,3 @@ | ||
},{"foreach":6,"object-keys":9}],6:[function(require,module,exports){ | ||
},{"foreach":5,"object-keys":9}],5:[function(require,module,exports){ | ||
@@ -206,3 +163,7 @@ var hasOwn = Object.prototype.hasOwnProperty; | ||
},{}],7:[function(require,module,exports){ | ||
},{}],6:[function(require,module,exports){ | ||
'use strict'; | ||
/* eslint no-invalid-this: 1 */ | ||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; | ||
@@ -257,3 +218,5 @@ var slice = Array.prototype.slice; | ||
},{}],8:[function(require,module,exports){ | ||
},{}],7:[function(require,module,exports){ | ||
'use strict'; | ||
var implementation = require('./implementation'); | ||
@@ -263,5 +226,49 @@ | ||
},{"./implementation":7}],9:[function(require,module,exports){ | ||
},{"./implementation":6}],8:[function(require,module,exports){ | ||
'use strict'; | ||
/* eslint complexity: [2, 17], max-statements: [2, 33] */ | ||
module.exports = function hasSymbols() { | ||
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; } | ||
if (typeof Symbol.iterator === 'symbol') { return true; } | ||
var obj = {}; | ||
var sym = Symbol('test'); | ||
var symObj = Object(sym); | ||
if (typeof sym === 'string') { return false; } | ||
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; } | ||
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; } | ||
// temp disabled per https://github.com/ljharb/object.assign/issues/17 | ||
// if (sym instanceof Symbol) { return false; } | ||
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4 | ||
// if (!(symObj instanceof Symbol)) { return false; } | ||
// if (typeof Symbol.prototype.toString !== 'function') { return false; } | ||
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; } | ||
var symVal = 42; | ||
obj[sym] = symVal; | ||
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax | ||
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; } | ||
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; } | ||
var syms = Object.getOwnPropertySymbols(obj); | ||
if (syms.length !== 1 || syms[0] !== sym) { return false; } | ||
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; } | ||
if (typeof Object.getOwnPropertyDescriptor === 'function') { | ||
var descriptor = Object.getOwnPropertyDescriptor(obj, sym); | ||
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; } | ||
} | ||
return true; | ||
}; | ||
},{}],9:[function(require,module,exports){ | ||
'use strict'; | ||
// modified from https://github.com/es-shims/es5-shim | ||
@@ -294,8 +301,16 @@ var has = Object.prototype.hasOwnProperty; | ||
$frames: true, | ||
$height: true, | ||
$innerHeight: true, | ||
$innerWidth: true, | ||
$outerHeight: true, | ||
$outerWidth: true, | ||
$pageXOffset: true, | ||
$pageYOffset: true, | ||
$parent: true, | ||
$scrollLeft: true, | ||
$scrollTop: true, | ||
$scrollX: true, | ||
$scrollY: true, | ||
$self: true, | ||
$webkitIndexedDB: true, | ||
$webkitStorageInfo: true, | ||
$width: true, | ||
$window: true | ||
@@ -471,3 +486,3 @@ }; | ||
},{"./implementation":3}],12:[function(require,module,exports){ | ||
},{"./implementation":2}],12:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -488,2 +503,2 @@ | ||
},{"./polyfill":11,"define-properties":5}]},{},[1]); | ||
},{"./polyfill":11,"define-properties":4}]},{},[1]); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
}; | ||
var hasSymbols = require('./hasSymbols')(); | ||
var hasSymbols = require('has-symbols/shams')(); | ||
var toObject = Object; | ||
@@ -12,0 +12,0 @@ var push = bind.call(Function.call, Array.prototype.push); |
@@ -12,4 +12,4 @@ 'use strict'; | ||
defineProperties(polyfill, { | ||
getPolyfill: getPolyfill, | ||
implementation: implementation, | ||
getPolyfill: getPolyfill, | ||
shim: shim | ||
@@ -16,0 +16,0 @@ }); |
{ | ||
"name": "object.assign", | ||
"version": "4.0.4", | ||
"version": "4.1.0", | ||
"author": "Jordan Harband", | ||
@@ -12,9 +12,6 @@ "description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim", | ||
"posttest": "npm run --silent security", | ||
"tests-only": "npm run --silent test:implementation && npm run --silent test:shim && npm run --silent test:shams", | ||
"tests-only": "npm run --silent test:implementation && npm run --silent test:shim", | ||
"test:native": "node test/native.js", | ||
"test:shim": "node test/shimmed.js", | ||
"test:implementation": "node test/index.js", | ||
"test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs", | ||
"test:shams:corejs": "node test/shams/core-js.js", | ||
"test:shams:getownpropertysymbols": "node test/shams/get-own-property-symbols.js", | ||
"coverage": "covert test/*.js", | ||
@@ -47,19 +44,18 @@ "coverage:quiet": "covert test/*.js --quiet", | ||
"dependencies": { | ||
"function-bind": "^1.1.0", | ||
"object-keys": "^1.0.10", | ||
"define-properties": "^1.1.2" | ||
"define-properties": "^1.1.2", | ||
"function-bind": "^1.1.1", | ||
"has-symbols": "^1.0.0", | ||
"object-keys": "^1.0.11" | ||
}, | ||
"devDependencies": { | ||
"browserify": "^13.0.1", | ||
"is": "^3.1.0", | ||
"tape": "^4.6.0", | ||
"@es-shims/api": "^2.1.1", | ||
"@ljharb/eslint-config": "^12.2.1", | ||
"browserify": "^14.5.0", | ||
"covert": "^1.1.0", | ||
"jscs": "^3.0.6", | ||
"nsp": "^2.5.0", | ||
"eslint": "^3.0.0", | ||
"@ljharb/eslint-config": "^6.0.0", | ||
"get-own-property-symbols": "^0.9.2", | ||
"core-js": "^2.4.0", | ||
"@es-shims/api": "^1.2.0", | ||
"for-each": "^0.3.2" | ||
"eslint": "^4.13.1", | ||
"for-each": "^0.3.2", | ||
"is": "^3.2.1", | ||
"jscs": "^3.0.7", | ||
"nsp": "^3.1.0", | ||
"tape": "^4.8.0" | ||
}, | ||
@@ -88,2 +84,1 @@ "testling": { | ||
} | ||
@@ -9,4 +9,4 @@ 'use strict'; | ||
t.test('bad array/this value', function (st) { | ||
st.throws(function () { assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st.throws(function () { assign(null); }, TypeError, 'null is not an object'); | ||
st['throws'](function () { assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st['throws'](function () { assign(null); }, TypeError, 'null is not an object'); | ||
st.end(); | ||
@@ -13,0 +13,0 @@ }); |
@@ -25,4 +25,4 @@ 'use strict'; | ||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) { | ||
st.throws(function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st.throws(function () { return Object.assign(null); }, TypeError, 'null is not an object'); | ||
st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); | ||
st.end(); | ||
@@ -29,0 +29,0 @@ }); |
@@ -28,4 +28,4 @@ 'use strict'; | ||
t.test('bad object value', { skip: !supportsStrictMode }, function (st) { | ||
st.throws(function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st.throws(function () { return Object.assign(null); }, TypeError, 'null is not an object'); | ||
st['throws'](function () { return Object.assign(undefined); }, TypeError, 'undefined is not an object'); | ||
st['throws'](function () { return Object.assign(null); }, TypeError, 'null is not an object'); | ||
st.end(); | ||
@@ -32,0 +32,0 @@ }); |
'use strict'; | ||
var hasSymbols = require('../hasSymbols')(); | ||
var hasSymbols = require('has-symbols/shams')(); | ||
var forEach = require('for-each'); | ||
@@ -8,6 +8,6 @@ | ||
t.test('error cases', function (st) { | ||
st.throws(function () { assign(null); }, TypeError, 'target must be an object'); | ||
st.throws(function () { assign(undefined); }, TypeError, 'target must be an object'); | ||
st.throws(function () { assign(null, {}); }, TypeError, 'target must be an object'); | ||
st.throws(function () { assign(undefined, {}); }, TypeError, 'target must be an object'); | ||
st['throws'](function () { assign(null); }, TypeError, 'target must be an object'); | ||
st['throws'](function () { assign(undefined); }, TypeError, 'target must be an object'); | ||
st['throws'](function () { assign(null, {}); }, TypeError, 'target must be an object'); | ||
st['throws'](function () { assign(undefined, {}); }, TypeError, 'target must be an object'); | ||
st.end(); | ||
@@ -124,3 +124,3 @@ }); | ||
st.equal(returned, target, 'returned object is the same reference as the target object'); | ||
st.deepEqual(target, { baz: true, a: 1 }, 'returned object has only own properties from both'); | ||
st.deepEqual(target, { a: 1, baz: true }, 'returned object has only own properties from both'); | ||
st.end(); | ||
@@ -132,7 +132,13 @@ }); | ||
var obj = {}; | ||
Object.defineProperty(obj, 'a', { get: function () { visited.push('a'); return 42; }, enumerable: true }); | ||
Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); | ||
var symbol = Symbol('enumerable'); | ||
Object.defineProperty(obj, symbol, { get: function () { visited.push(symbol); return Infinity; }, enumerable: true }); | ||
Object.defineProperty(obj, symbol, { | ||
enumerable: true, | ||
get: function () { visited.push(symbol); return Infinity; } | ||
}); | ||
var nonEnumSymbol = Symbol('non-enumerable'); | ||
Object.defineProperty(obj, nonEnumSymbol, { get: function () { visited.push(nonEnumSymbol); return -Infinity; }, enumerable: false }); | ||
Object.defineProperty(obj, nonEnumSymbol, { | ||
enumerable: false, | ||
get: function () { visited.push(nonEnumSymbol); return -Infinity; } | ||
}); | ||
var target = assign({}, obj); | ||
@@ -155,9 +161,9 @@ st.deepEqual(visited, ['a', symbol], 'key is visited first, then symbol'); | ||
var obj = {}; | ||
Object.defineProperty(obj, 'a', { get: function () { visited.push('a'); return 42; }, enumerable: true }); | ||
Object.defineProperty(obj, 'a', { enumerable: true, get: function () { visited.push('a'); return 42; } }); | ||
var keys = ['a']; | ||
if (hasSymbols) { | ||
var symbol = Symbol(); | ||
var symbol = Symbol('sym'); | ||
Object.defineProperty(obj, symbol, { | ||
get: function () { visited.push(symbol); return Infinity; }, | ||
enumerable: true | ||
enumerable: true, | ||
get: function () { visited.push(symbol); return Infinity; } | ||
}); | ||
@@ -204,7 +210,8 @@ keys.push(symbol); | ||
Object.defineProperty(source, 'a', { | ||
enumerable: true, | ||
get: function () { | ||
delete this.b; | ||
Object.defineProperty(this, 'c', { enumerable: false }); | ||
}, | ||
enumerable: true | ||
return 'a'; | ||
} | ||
}); | ||
@@ -211,0 +218,0 @@ var sourceBvalue = {}; |
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
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
46354
10
19
0
136
4
848
+ Addedhas-symbols@^1.0.0
Updatedfunction-bind@^1.1.1
Updatedobject-keys@^1.0.11