object.assign
Advanced tools
Comparing version 4.1.1 to 4.1.2
@@ -0,1 +1,8 @@ | ||
4.1.2 / 2020-10-30 | ||
================== | ||
* [Refactor] use extracted `call-bind` instead of full `es-abstract` | ||
* [Dev Deps] update `eslint`, `ses`, `browserify` | ||
* [Tests] run tests in SES | ||
* [Tests] ses-compat: show error stacks | ||
4.1.1 / 2020-09-11 | ||
@@ -2,0 +9,0 @@ ================== |
@@ -13,3 +13,3 @@ (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
},{"./":3,"object-keys":16}],2:[function(require,module,exports){ | ||
},{"./":3,"object-keys":14}],2:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -23,3 +23,3 @@ | ||
var hasSymbols = require('has-symbols/shams')(); | ||
var callBound = require('es-abstract/helpers/callBound'); | ||
var callBound = require('call-bind/callBound'); | ||
var toObject = Object; | ||
@@ -59,7 +59,7 @@ var $push = callBound('Array.prototype.push'); | ||
},{"es-abstract/helpers/callBound":7,"has-symbols/shams":11,"object-keys":16}],3:[function(require,module,exports){ | ||
},{"call-bind/callBound":4,"has-symbols/shams":11,"object-keys":14}],3:[function(require,module,exports){ | ||
'use strict'; | ||
var defineProperties = require('define-properties'); | ||
var callBind = require('es-abstract/helpers/callBind'); | ||
var callBind = require('call-bind'); | ||
@@ -84,5 +84,57 @@ var implementation = require('./implementation'); | ||
},{"./implementation":2,"./polyfill":18,"./shim":19,"define-properties":4,"es-abstract/helpers/callBind":6}],4:[function(require,module,exports){ | ||
},{"./implementation":2,"./polyfill":16,"./shim":17,"call-bind":5,"define-properties":6}],4:[function(require,module,exports){ | ||
'use strict'; | ||
var GetIntrinsic = require('get-intrinsic'); | ||
var callBind = require('./'); | ||
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); | ||
module.exports = function callBoundIntrinsic(name, allowMissing) { | ||
var intrinsic = GetIntrinsic(name, !!allowMissing); | ||
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) { | ||
return callBind(intrinsic); | ||
} | ||
return intrinsic; | ||
}; | ||
},{"./":5,"get-intrinsic":9}],5:[function(require,module,exports){ | ||
'use strict'; | ||
var bind = require('function-bind'); | ||
var GetIntrinsic = require('get-intrinsic'); | ||
var $apply = GetIntrinsic('%Function.prototype.apply%'); | ||
var $call = GetIntrinsic('%Function.prototype.call%'); | ||
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); | ||
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true); | ||
if ($defineProperty) { | ||
try { | ||
$defineProperty({}, 'a', { value: 1 }); | ||
} catch (e) { | ||
// IE 8 has a broken defineProperty | ||
$defineProperty = null; | ||
} | ||
} | ||
module.exports = function callBind() { | ||
return $reflectApply(bind, $call, arguments); | ||
}; | ||
var applyBind = function applyBind() { | ||
return $reflectApply(bind, $apply, arguments); | ||
}; | ||
if ($defineProperty) { | ||
$defineProperty(module.exports, 'apply', { value: applyBind }); | ||
} else { | ||
module.exports.apply = applyBind; | ||
} | ||
},{"function-bind":8,"get-intrinsic":9}],6:[function(require,module,exports){ | ||
'use strict'; | ||
var keys = require('object-keys'); | ||
@@ -145,5 +197,66 @@ var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
},{"object-keys":16}],5:[function(require,module,exports){ | ||
},{"object-keys":14}],7:[function(require,module,exports){ | ||
'use strict'; | ||
/* eslint no-invalid-this: 1 */ | ||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; | ||
var slice = Array.prototype.slice; | ||
var toStr = Object.prototype.toString; | ||
var funcType = '[object Function]'; | ||
module.exports = function bind(that) { | ||
var target = this; | ||
if (typeof target !== 'function' || toStr.call(target) !== funcType) { | ||
throw new TypeError(ERROR_MESSAGE + target); | ||
} | ||
var args = slice.call(arguments, 1); | ||
var bound; | ||
var binder = function () { | ||
if (this instanceof bound) { | ||
var result = target.apply( | ||
this, | ||
args.concat(slice.call(arguments)) | ||
); | ||
if (Object(result) === result) { | ||
return result; | ||
} | ||
return this; | ||
} else { | ||
return target.apply( | ||
that, | ||
args.concat(slice.call(arguments)) | ||
); | ||
} | ||
}; | ||
var boundLength = Math.max(0, target.length - args.length); | ||
var boundArgs = []; | ||
for (var i = 0; i < boundLength; i++) { | ||
boundArgs.push('$' + i); | ||
} | ||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); | ||
if (target.prototype) { | ||
var Empty = function Empty() {}; | ||
Empty.prototype = target.prototype; | ||
bound.prototype = new Empty(); | ||
Empty.prototype = null; | ||
} | ||
return bound; | ||
}; | ||
},{}],8:[function(require,module,exports){ | ||
'use strict'; | ||
var implementation = require('./implementation'); | ||
module.exports = Function.prototype.bind || implementation; | ||
},{"./implementation":7}],9:[function(require,module,exports){ | ||
'use strict'; | ||
/* globals | ||
@@ -180,3 +293,5 @@ AggregateError, | ||
var throwTypeError = function () { throw new $TypeError(); }; | ||
var throwTypeError = function () { | ||
throw new $TypeError(); | ||
}; | ||
var ThrowTypeError = $gOPD | ||
@@ -413,3 +528,14 @@ ? (function () { | ||
} | ||
value = isOwn ? desc.get || desc.value : value[part]; | ||
// By convention, when a data property is converted to an accessor | ||
// property to emulate a data property that does not suffer from | ||
// the override mistake, that accessor's getter is marked with | ||
// an `originalValue` property. Here, when we detect this, we | ||
// uphold the illusion by pretending to see that original data | ||
// property, i.e., returning the value rather than the getter | ||
// itself. | ||
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) { | ||
value = desc.get; | ||
} else { | ||
value = value[part]; | ||
} | ||
} else { | ||
@@ -428,103 +554,6 @@ isOwn = hasOwn(value, part); | ||
},{"function-bind":9,"has":14,"has-symbols":10}],6:[function(require,module,exports){ | ||
},{"function-bind":8,"has":12,"has-symbols":10}],10:[function(require,module,exports){ | ||
(function (global){(function (){ | ||
'use strict'; | ||
var bind = require('function-bind'); | ||
var GetIntrinsic = require('../GetIntrinsic'); | ||
var $apply = GetIntrinsic('%Function.prototype.apply%'); | ||
var $call = GetIntrinsic('%Function.prototype.call%'); | ||
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply); | ||
module.exports = function callBind() { | ||
return $reflectApply(bind, $call, arguments); | ||
}; | ||
module.exports.apply = function applyBind() { | ||
return $reflectApply(bind, $apply, arguments); | ||
}; | ||
},{"../GetIntrinsic":5,"function-bind":9}],7:[function(require,module,exports){ | ||
'use strict'; | ||
var GetIntrinsic = require('../GetIntrinsic'); | ||
var callBind = require('./callBind'); | ||
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf')); | ||
module.exports = function callBoundIntrinsic(name, allowMissing) { | ||
var intrinsic = GetIntrinsic(name, !!allowMissing); | ||
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.')) { | ||
return callBind(intrinsic); | ||
} | ||
return intrinsic; | ||
}; | ||
},{"../GetIntrinsic":5,"./callBind":6}],8:[function(require,module,exports){ | ||
'use strict'; | ||
/* eslint no-invalid-this: 1 */ | ||
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible '; | ||
var slice = Array.prototype.slice; | ||
var toStr = Object.prototype.toString; | ||
var funcType = '[object Function]'; | ||
module.exports = function bind(that) { | ||
var target = this; | ||
if (typeof target !== 'function' || toStr.call(target) !== funcType) { | ||
throw new TypeError(ERROR_MESSAGE + target); | ||
} | ||
var args = slice.call(arguments, 1); | ||
var bound; | ||
var binder = function () { | ||
if (this instanceof bound) { | ||
var result = target.apply( | ||
this, | ||
args.concat(slice.call(arguments)) | ||
); | ||
if (Object(result) === result) { | ||
return result; | ||
} | ||
return this; | ||
} else { | ||
return target.apply( | ||
that, | ||
args.concat(slice.call(arguments)) | ||
); | ||
} | ||
}; | ||
var boundLength = Math.max(0, target.length - args.length); | ||
var boundArgs = []; | ||
for (var i = 0; i < boundLength; i++) { | ||
boundArgs.push('$' + i); | ||
} | ||
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder); | ||
if (target.prototype) { | ||
var Empty = function Empty() {}; | ||
Empty.prototype = target.prototype; | ||
bound.prototype = new Empty(); | ||
Empty.prototype = null; | ||
} | ||
return bound; | ||
}; | ||
},{}],9:[function(require,module,exports){ | ||
'use strict'; | ||
var implementation = require('./implementation'); | ||
module.exports = Function.prototype.bind || implementation; | ||
},{"./implementation":8}],10:[function(require,module,exports){ | ||
(function (global){ | ||
'use strict'; | ||
var origSymbol = global.Symbol; | ||
@@ -542,3 +571,3 @@ var hasSymbolSham = require('./shams'); | ||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
}).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) | ||
},{"./shams":11}],11:[function(require,module,exports){ | ||
@@ -589,6 +618,2 @@ 'use strict'; | ||
},{}],12:[function(require,module,exports){ | ||
arguments[4][8][0].apply(exports,arguments) | ||
},{"dup":8}],13:[function(require,module,exports){ | ||
arguments[4][9][0].apply(exports,arguments) | ||
},{"./implementation":12,"dup":9}],14:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -600,3 +625,3 @@ | ||
},{"function-bind":13}],15:[function(require,module,exports){ | ||
},{"function-bind":8}],13:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -725,3 +750,3 @@ | ||
},{"./isArguments":17}],16:[function(require,module,exports){ | ||
},{"./isArguments":15}],14:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -760,3 +785,3 @@ | ||
},{"./implementation":15,"./isArguments":17}],17:[function(require,module,exports){ | ||
},{"./implementation":13,"./isArguments":15}],15:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -780,3 +805,3 @@ | ||
},{}],18:[function(require,module,exports){ | ||
},{}],16:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -838,3 +863,3 @@ | ||
},{"./implementation":2}],19:[function(require,module,exports){ | ||
},{"./implementation":2}],17:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -855,2 +880,2 @@ | ||
},{"./polyfill":18,"define-properties":4}]},{},[1]); | ||
},{"./polyfill":16,"define-properties":6}]},{},[1]); |
@@ -9,3 +9,3 @@ 'use strict'; | ||
var hasSymbols = require('has-symbols/shams')(); | ||
var callBound = require('es-abstract/helpers/callBound'); | ||
var callBound = require('call-bind/callBound'); | ||
var toObject = Object; | ||
@@ -12,0 +12,0 @@ var $push = callBound('Array.prototype.push'); |
'use strict'; | ||
var defineProperties = require('define-properties'); | ||
var callBind = require('es-abstract/helpers/callBind'); | ||
var callBind = require('call-bind'); | ||
@@ -6,0 +6,0 @@ var implementation = require('./implementation'); |
{ | ||
"name": "object.assign", | ||
"version": "4.1.1", | ||
"version": "4.1.2", | ||
"author": "Jordan Harband", | ||
@@ -12,11 +12,10 @@ "funding": { | ||
"scripts": { | ||
"pretest": "npm run --silent lint && es-shim-api --bound", | ||
"test": "npm run --silent tests-only && npm run test:ses", | ||
"pretest": "npm run lint && es-shim-api --bound", | ||
"test": "npm run tests-only && npm run test:ses", | ||
"posttest": "aud --production", | ||
"tests-only": "npm run --silent test:implementation && npm run --silent test:shim", | ||
"test:native": "node test/native", | ||
"test:shim": "node test/shimmed", | ||
"test:implementation": "node test", | ||
"tests-only": "npm run test:implementation && npm run test:shim", | ||
"test:native": "nyc node test/native", | ||
"test:shim": "nyc node test/shimmed", | ||
"test:implementation": "nyc node test", | ||
"test:ses": "node test/ses-compat", | ||
"coverage": "covert test/*.js", | ||
"lint": "eslint .", | ||
@@ -44,4 +43,4 @@ "build": "mkdir -p dist && browserify browserShim.js > dist/browser.js", | ||
"dependencies": { | ||
"call-bind": "^1.0.0", | ||
"define-properties": "^1.1.3", | ||
"es-abstract": "^1.18.0-next.0", | ||
"has-symbols": "^1.0.1", | ||
@@ -54,5 +53,4 @@ "object-keys": "^1.1.1" | ||
"aud": "^1.1.2", | ||
"browserify": "^16.5.0", | ||
"covert": "^1.1.1", | ||
"eslint": "^7.8.1", | ||
"browserify": "^16.5.2", | ||
"eslint": "^7.12.1", | ||
"for-each": "^0.3.3", | ||
@@ -62,4 +60,5 @@ "functions-have-names": "^1.2.1", | ||
"is": "^3.3.0", | ||
"nyc": "^10.3.2", | ||
"safe-publish-latest": "^1.1.4", | ||
"ses": "^0.10.3", | ||
"ses": "^0.10.4", | ||
"tape": "^5.0.1" | ||
@@ -66,0 +65,0 @@ }, |
'use strict'; | ||
/* globals lockdown */ | ||
// requiring ses exposes "lockdown" on the global | ||
require('ses'); | ||
/* | ||
* lockdown freezes the primordials | ||
* disabling the error taming makes debugging much easier | ||
* lockdown({ errorTaming: 'unsafe' }); | ||
*/ | ||
// eslint-disable-next-line no-undef | ||
lockdown(); | ||
// lockdown freezes the primordials | ||
lockdown({ errorTaming: 'unsafe' }); | ||
// initialize the module | ||
require('..'); | ||
require('./'); |
@@ -162,3 +162,3 @@ 'use strict'; | ||
t.test('does not fail when symbols are not present', function (st) { | ||
t.test('does not fail when symbols are not present', { skip: !Object.isFrozen || Object.isFrozen(Object) }, function (st) { | ||
var getSyms; | ||
@@ -165,0 +165,0 @@ if (hasSymbols) { |
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
62368
23
1209
+ Addedcall-bind@^1.0.0
- Removedes-abstract@^1.18.0-next.0
- Removedarray-buffer-byte-length@1.0.1(transitive)
- Removedarraybuffer.prototype.slice@1.0.3(transitive)
- Removedavailable-typed-arrays@1.0.7(transitive)
- Removeddata-view-buffer@1.0.1(transitive)
- Removeddata-view-byte-length@1.0.1(transitive)
- Removeddata-view-byte-offset@1.0.0(transitive)
- Removedes-abstract@1.23.5(transitive)
- Removedes-object-atoms@1.0.0(transitive)
- Removedes-set-tostringtag@2.0.3(transitive)
- Removedes-to-primitive@1.2.1(transitive)
- Removedfor-each@0.3.3(transitive)
- Removedfunction.prototype.name@1.1.6(transitive)
- Removedfunctions-have-names@1.2.3(transitive)
- Removedget-symbol-description@1.0.2(transitive)
- Removedglobalthis@1.0.4(transitive)
- Removedhas-bigints@1.0.2(transitive)
- Removedhas-tostringtag@1.0.2(transitive)
- Removedinternal-slot@1.0.7(transitive)
- Removedis-array-buffer@3.0.4(transitive)
- Removedis-bigint@1.0.4(transitive)
- Removedis-boolean-object@1.1.2(transitive)
- Removedis-callable@1.2.7(transitive)
- Removedis-data-view@1.0.1(transitive)
- Removedis-date-object@1.0.5(transitive)
- Removedis-negative-zero@2.0.3(transitive)
- Removedis-number-object@1.0.7(transitive)
- Removedis-regex@1.1.4(transitive)
- Removedis-shared-array-buffer@1.0.3(transitive)
- Removedis-string@1.0.7(transitive)
- Removedis-symbol@1.0.4(transitive)
- Removedis-typed-array@1.1.13(transitive)
- Removedis-weakref@1.0.2(transitive)
- Removedisarray@2.0.5(transitive)
- Removedobject-inspect@1.13.3(transitive)
- Removedobject.assign@4.1.5(transitive)
- Removedpossible-typed-array-names@1.0.0(transitive)
- Removedregexp.prototype.flags@1.5.3(transitive)
- Removedsafe-array-concat@1.1.2(transitive)
- Removedsafe-regex-test@1.0.3(transitive)
- Removedset-function-name@2.0.2(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedstring.prototype.trim@1.2.9(transitive)
- Removedstring.prototype.trimend@1.0.8(transitive)
- Removedstring.prototype.trimstart@1.0.8(transitive)
- Removedtyped-array-buffer@1.0.2(transitive)
- Removedtyped-array-byte-length@1.0.1(transitive)
- Removedtyped-array-byte-offset@1.0.2(transitive)
- Removedtyped-array-length@1.0.6(transitive)
- Removedunbox-primitive@1.0.2(transitive)
- Removedwhich-boxed-primitive@1.0.2(transitive)
- Removedwhich-typed-array@1.1.15(transitive)