object.assign
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,10 @@ | ||
2.0.2 / 2015-05-20 | ||
================== | ||
* Make sure `.shim` is non-enumerable. | ||
* Refactor `.shim` implementation to use `define-properties` predicates, rather than `delete`ing the original. | ||
* Update docs to match spec/implementation. (#11) | ||
* Add `npm run eslint` | ||
* Test up to `io.js` `v2.0` | ||
* Update `jscs`, `browserify`, `covert` | ||
2.0.1 / 2015-04-12 | ||
@@ -2,0 +11,0 @@ ================== |
(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){ | ||
var keys = require('object-keys').shim(); | ||
delete keys.shim; | ||
var assign = require('./'); | ||
module.exports = assign.shim(); | ||
delete assign.shim; | ||
},{"./":2,"object-keys":5}],2:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -44,5 +35,8 @@ | ||
assignShim.shim = function shimObjectAssign() { | ||
if (Object.assign && Object.preventExtensions) { | ||
var assignHasPendingExceptions = (function () { | ||
defineProperties(assignShim, { | ||
shim: function shimObjectAssign() { | ||
var assignHasPendingExceptions = function () { | ||
if (!Object.assign || !Object.preventExtensions) { | ||
return false; | ||
} | ||
// Firefox 37 still has "pending exception" logic in its Object.assign implementation, | ||
@@ -56,14 +50,11 @@ // which is 72% slower than our shim, and Firefox 40's native implementation. | ||
} | ||
}()); | ||
if (assignHasPendingExceptions) { | ||
delete Object.assign; | ||
} | ||
}; | ||
defineProperties( | ||
Object, | ||
{ assign: assignShim }, | ||
{ assign: assignHasPendingExceptions } | ||
); | ||
return Object.assign || assignShim; | ||
} | ||
if (!Object.assign) { | ||
defineProperties(Object, { | ||
assign: assignShim | ||
}); | ||
} | ||
return Object.assign || assignShim; | ||
}; | ||
}); | ||
@@ -73,3 +64,3 @@ module.exports = assignShim; | ||
},{"define-properties":3,"object-keys":5}],3:[function(require,module,exports){ | ||
},{"define-properties":2,"object-keys":4}],2:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -124,3 +115,3 @@ | ||
},{"foreach":4,"object-keys":5}],4:[function(require,module,exports){ | ||
},{"foreach":3,"object-keys":4}],3:[function(require,module,exports){ | ||
@@ -149,3 +140,3 @@ var hasOwn = Object.prototype.hasOwnProperty; | ||
},{}],5:[function(require,module,exports){ | ||
},{}],4:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -221,3 +212,3 @@ | ||
},{"./isArguments":6}],6:[function(require,module,exports){ | ||
},{"./isArguments":5}],5:[function(require,module,exports){ | ||
'use strict'; | ||
@@ -241,2 +232,12 @@ | ||
},{}]},{},[1]); | ||
},{}],6:[function(require,module,exports){ | ||
var keys = require('object-keys').shim(); | ||
delete keys.shim; | ||
var assign = require('./'); | ||
module.exports = assign.shim(); | ||
delete assign.shim; | ||
},{"./":1,"object-keys":4}]},{},[6]); |
28
index.js
@@ -34,5 +34,8 @@ 'use strict'; | ||
assignShim.shim = function shimObjectAssign() { | ||
if (Object.assign && Object.preventExtensions) { | ||
var assignHasPendingExceptions = (function () { | ||
defineProperties(assignShim, { | ||
shim: function shimObjectAssign() { | ||
var assignHasPendingExceptions = function () { | ||
if (!Object.assign || !Object.preventExtensions) { | ||
return false; | ||
} | ||
// Firefox 37 still has "pending exception" logic in its Object.assign implementation, | ||
@@ -46,16 +49,13 @@ // which is 72% slower than our shim, and Firefox 40's native implementation. | ||
} | ||
}()); | ||
if (assignHasPendingExceptions) { | ||
delete Object.assign; | ||
} | ||
}; | ||
defineProperties( | ||
Object, | ||
{ assign: assignShim }, | ||
{ assign: assignHasPendingExceptions } | ||
); | ||
return Object.assign || assignShim; | ||
} | ||
if (!Object.assign) { | ||
defineProperties(Object, { | ||
assign: assignShim | ||
}); | ||
} | ||
return Object.assign || assignShim; | ||
}; | ||
}); | ||
module.exports = assignShim; | ||
{ | ||
"name": "object.assign", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"author": "Jordan Harband", | ||
@@ -12,3 +12,5 @@ "description": "ES6 spec-compliant Object.assign shim. From https://github.com/es-shims/es6-shim", | ||
"coverage:quiet": "covert test/*.js --quiet", | ||
"lint": "jscs *.js test/*.js", | ||
"lint": "npm run jscs && npm run eslint", | ||
"eslint": "eslint *.js test/*.js", | ||
"jscs": "jscs *.js test/*.js", | ||
"build": "mkdir -p dist && browserify browserShim.js > dist/browser.js", | ||
@@ -37,8 +39,9 @@ "prepublish": "npm run build", | ||
"devDependencies": { | ||
"browserify": "^9.0.8", | ||
"browserify": "^10.1.3", | ||
"is": "^3.0.1", | ||
"tape": "^4.0.0", | ||
"covert": "^1.0.1", | ||
"jscs": "^1.11.3", | ||
"nsp": "^1.0.1" | ||
"covert": "^1.1.0", | ||
"jscs": "^1.13.1", | ||
"nsp": "^1.0.1", | ||
"eslint": "^0.21.0" | ||
}, | ||
@@ -45,0 +48,0 @@ "testling": { |
@@ -15,5 +15,5 @@ #object.assign <sup>[![Version Badge][npm-version-svg]][npm-url]</sup> | ||
Takes a minimum of 2 object arguments: `target` and `source`. | ||
Takes a minimum of 2 arguments: `target` and `source`. | ||
Takes a variable sized list of source arguments - at least 1, as many as you want. | ||
Throws a TypeError if any arguments are not objects. | ||
Throws a TypeError if the `target` argument is `null` or `undefined`. | ||
@@ -20,0 +20,0 @@ Most common usage: |
@@ -1,10 +0,6 @@ | ||
'use strict'; | ||
var test = require('tape'); | ||
var assign = require('../index.js'); | ||
var keys = require('object-keys'); | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
test('error cases', function (t) { | ||
var target = {}; | ||
t.throws(function () { assign(null); }, TypeError, 'target must be an object'); | ||
@@ -103,3 +99,2 @@ t.end(); | ||
var visited = []; | ||
@@ -154,2 +149,7 @@ var obj = {}; | ||
'use strict'; | ||
var originalObjectAssign = Object.assign; | ||
delete Object.assign; | ||
assign.shim(); | ||
// Firefox 37 still has "pending exception" logic in its Object.assign implementation, | ||
@@ -162,2 +162,4 @@ // which is 72% slower than our shim, and Firefox 40's native implementation. | ||
st.equal(thrower[1], 2, 'thrower[1] === 2'); | ||
Object.assign = originalObjectAssign; | ||
st.end(); | ||
@@ -164,0 +166,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
28380
8
403
7