Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

object.assign

Package Overview
Dependencies
Maintainers
1
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object.assign - npm Package Compare versions

Comparing version 4.0.3 to 4.0.4

test.sh

9

CHANGELOG.md

@@ -0,1 +1,10 @@

4.0.4 / 2016-07-04
==================
* [Fix] Cache original `getOwnPropertySymbols`, and use that when `Object.getOwnPropertySymbols` is unavailable
* [Deps] update `object-keys`
* [Dev Deps] update `eslint`, `get-own-property-symbols`, `core-js`, `jscs`, `nsp`, `browserify`, `@ljharb/eslint-config`, `tape`, `@es-shims/api`
* [Tests] up to `node` `v6.2`, `v5.10`, `v4.4`
* [Tests] run sham tests on node 0.10
* [Tests] use pretest/posttest for linting/security
4.0.3 / 2015-10-21

@@ -2,0 +11,0 @@ ==================

58

dist/browser.js

@@ -13,3 +13,3 @@ (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":8}],2:[function(require,module,exports){
},{"./":4,"object-keys":9}],2:[function(require,module,exports){
'use strict';

@@ -25,8 +25,12 @@

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 (!(Object(sym) instanceof Symbol)) { return false; }
// if (!(symObj instanceof Symbol)) { return false; }

@@ -54,3 +58,3 @@ var symVal = 42;

},{"object-keys":8}],3:[function(require,module,exports){
},{"object-keys":9}],3:[function(require,module,exports){
'use strict';

@@ -68,2 +72,3 @@

var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;

@@ -77,4 +82,5 @@ module.exports = function assign(target, source1) {

props = keys(source);
if (hasSymbols && Object.getOwnPropertySymbols) {
syms = Object.getOwnPropertySymbols(source);
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
syms = getSymbols(source);
for (i = 0; i < syms.length; ++i) {

@@ -98,3 +104,3 @@ key = syms[i];

},{"./hasSymbols":2,"function-bind":7,"object-keys":8}],4:[function(require,module,exports){
},{"./hasSymbols":2,"function-bind":8,"object-keys":9}],4:[function(require,module,exports){
'use strict';

@@ -108,3 +114,5 @@

defineProperties(implementation, {
var polyfill = getPolyfill();
defineProperties(polyfill, {
implementation: implementation,

@@ -115,5 +123,5 @@ getPolyfill: getPolyfill,

module.exports = implementation;
module.exports = polyfill;
},{"./implementation":3,"./polyfill":10,"./shim":11,"define-properties":5}],5:[function(require,module,exports){
},{"./implementation":3,"./polyfill":11,"./shim":12,"define-properties":5}],5:[function(require,module,exports){
'use strict';

@@ -176,3 +184,3 @@

},{"foreach":6,"object-keys":8}],6:[function(require,module,exports){
},{"foreach":6,"object-keys":9}],6:[function(require,module,exports){

@@ -214,2 +222,3 @@ var hasOwn = Object.prototype.hasOwnProperty;

var bound;
var binder = function () {

@@ -239,3 +248,3 @@ if (this instanceof bound) {

var bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);

@@ -252,4 +261,8 @@ if (target.prototype) {

},{}],8:[function(require,module,exports){
var implementation = require('./implementation');
},{}],8:[function(require,module,exports){
module.exports = Function.prototype.bind || implementation;
},{"./implementation":7}],9:[function(require,module,exports){
'use strict';

@@ -262,4 +275,5 @@

var isArgs = require('./isArguments');
var hasDontEnumBug = !({ toString: null }).propertyIsEnumerable('toString');
var hasProtoEnumBug = function () {}.propertyIsEnumerable('prototype');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
var dontEnums = [

@@ -278,7 +292,9 @@ 'toString',

};
var blacklistedKeys = {
var excludedKeys = {
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$height: true,
$parent: true,

@@ -288,2 +304,3 @@ $self: true,

$webkitStorageInfo: true,
$width: true,
$window: true

@@ -296,3 +313,3 @@ };

try {
if (!blacklistedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {

@@ -388,3 +405,3 @@ equalsConstructorPrototype(window[k]);

},{"./isArguments":9}],9:[function(require,module,exports){
},{"./isArguments":10}],10:[function(require,module,exports){
'use strict';

@@ -408,3 +425,3 @@

},{}],10:[function(require,module,exports){
},{}],11:[function(require,module,exports){
'use strict';

@@ -446,2 +463,3 @@

}
return false;
};

@@ -462,3 +480,3 @@

},{"./implementation":3}],11:[function(require,module,exports){
},{"./implementation":3}],12:[function(require,module,exports){
'use strict';

@@ -479,2 +497,2 @@

},{"./polyfill":10,"define-properties":5}]},{},[1]);
},{"./polyfill":11,"define-properties":5}]},{},[1]);

@@ -11,8 +11,12 @@ 'use strict';

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 (!(Object(sym) instanceof Symbol)) { return false; }
// if (!(symObj instanceof Symbol)) { return false; }

@@ -19,0 +23,0 @@ var symVal = 42;

@@ -13,2 +13,3 @@ 'use strict';

var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;

@@ -22,4 +23,5 @@ module.exports = function assign(target, source1) {

props = keys(source);
if (hasSymbols && Object.getOwnPropertySymbols) {
syms = Object.getOwnPropertySymbols(source);
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
syms = getSymbols(source);
for (i = 0; i < syms.length; ++i) {

@@ -26,0 +28,0 @@ key = syms[i];

@@ -9,3 +9,5 @@ 'use strict';

defineProperties(implementation, {
var polyfill = getPolyfill();
defineProperties(polyfill, {
implementation: implementation,

@@ -16,2 +18,2 @@ getPolyfill: getPolyfill,

module.exports = implementation;
module.exports = polyfill;
{
"name": "object.assign",
"version": "4.0.3",
"version": "4.0.4",
"author": "Jordan Harband",

@@ -9,7 +9,10 @@ "description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim",

"scripts": {
"test": "npm run lint && es-shim-api && npm run tests-only && npm run security",
"tests-only": "npm run test:implementation && npm run test:shim && npm run test:shams",
"pretest": "npm run --silent lint && es-shim-api",
"test": "npm run --silent tests-only",
"posttest": "npm run --silent security",
"tests-only": "npm run --silent test:implementation && npm run --silent test:shim && npm run --silent test:shams",
"test:native": "node test/native.js",
"test:shim": "node test/shimmed.js",
"test:implementation": "node test/index.js",
"test:shams": "npm run test:shams:getownpropertysymbols && npm run test:shams:corejs",
"test:shams": "npm run --silent test:shams:getownpropertysymbols && npm run --silent test:shams:corejs",
"test:shams:corejs": "node test/shams/core-js.js",

@@ -19,8 +22,8 @@ "test:shams:getownpropertysymbols": "node test/shams/get-own-property-symbols.js",

"coverage:quiet": "covert test/*.js --quiet",
"lint": "npm run jscs && npm run eslint",
"lint": "npm run --silent jscs && npm run --silent eslint",
"eslint": "eslint *.js test/*.js",
"jscs": "jscs *.js test/*.js",
"build": "mkdir -p dist && browserify browserShim.js > dist/browser.js",
"prepublish": "npm run build",
"security": "requiresafe check"
"prepublish": "npm run --silent build",
"security": "nsp check"
},

@@ -45,18 +48,18 @@ "repository": {

"dependencies": {
"function-bind": "^1.0.2",
"object-keys": "^1.0.9",
"function-bind": "^1.1.0",
"object-keys": "^1.0.10",
"define-properties": "^1.1.2"
},
"devDependencies": {
"browserify": "^11.2.0",
"browserify": "^13.0.1",
"is": "^3.1.0",
"tape": "^4.2.2",
"tape": "^4.6.0",
"covert": "^1.1.0",
"jscs": "^2.3.5",
"requiresafe": "^2.3.0",
"eslint": "^1.7.2",
"@ljharb/eslint-config": "^1.4.1",
"get-own-property-symbols": "^0.5.1",
"core-js": "^1.2.2",
"@es-shims/api": "^1.0.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"

@@ -63,0 +66,0 @@ },

@@ -37,2 +37,3 @@ 'use strict';

}
return false;
};

@@ -39,0 +40,0 @@

@@ -18,3 +18,4 @@ 'use strict';

t.equal(hasSymbols(), false, 'hasSymbols is false before polyfilling');
require('core-js/modules/es6.symbol');
require('core-js/fn/symbol');
require('core-js/fn/symbol/to-string-tag');
var hasSymbolsAfter = hasSymbols();

@@ -21,0 +22,0 @@ t.equal(hasSymbolsAfter, true, 'hasSymbols is true after polyfilling');

'use strict';
var hasSymbols = require('../hasSymbols')();
var keys = require('object-keys');
var forEach = require('for-each');

@@ -154,14 +153,17 @@

Object.defineProperty(obj, 'a', { get: function () { visited.push('a'); return 42; }, enumerable: true });
var keys = ['a'];
if (hasSymbols) {
var symbol = Symbol();
Object.defineProperty(obj, symbol, { get: function () { visited.push(symbol); return Infinity; }, enumerable: true });
Object.defineProperty(obj, symbol, {
get: function () { visited.push(symbol); return Infinity; },
enumerable: true
});
keys.push(symbol);
}
var target = assign({}, obj);
st.deepEqual(visited, keys, 'assign visits expected keys');
st.equal(target.a, 42, 'target.a is 42');
st.deepEqual(visited, ['a'], 'only key is visited');
if (hasSymbols) {
// sanity check for "visited" array
st.equal(obj[symbol], Infinity);
st.deepEqual(visited, ['a', symbol], 'symbol is visited manually');
st.equal(target[symbol], Infinity);

@@ -194,3 +196,4 @@ Object.getOwnPropertySymbols = getSyms;

t.test('checks enumerability and existence, in case of modification during [[Get]]', { skip: !Object.defineProperty }, function (st) {
var targetBvalue = {}, targetCvalue = {};
var targetBvalue = {};
var targetCvalue = {};
var target = { b: targetBvalue, c: targetCvalue };

@@ -205,3 +208,4 @@ var source = {};

});
var sourceBvalue = {}, sourceCvalue = {};
var sourceBvalue = {};
var sourceCvalue = {};
source.b = sourceBvalue;

@@ -208,0 +212,0 @@ source.c = sourceCvalue;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc