define-properties
Advanced tools
Comparing version 1.1.2 to 1.1.3
@@ -12,3 +12,6 @@ { | ||
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], | ||
"requireCurlyBraces": { | ||
"allExcept": [], | ||
"keywords": ["if", "else", "for", "while", "do", "try", "catch"] | ||
}, | ||
@@ -20,2 +23,3 @@ "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
"disallowSpaceBeforeComma": true, | ||
"disallowSpaceAfterComma": false, | ||
"disallowSpaceBeforeSemicolon": true, | ||
@@ -31,3 +35,3 @@ | ||
"requireObjectKeysOnNewLine": false, | ||
"requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, | ||
@@ -46,3 +50,3 @@ "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
"disallowQuotedKeysInObjects": "allButReserved", | ||
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, | ||
@@ -82,3 +86,3 @@ "disallowSpaceAfterObjectKeys": true, | ||
"requireDotNotation": true, | ||
"requireDotNotation": { "allExcept": ["keywords"] }, | ||
@@ -134,4 +138,44 @@ "requireParenthesesAroundIIFE": true, | ||
"requireSpaceAfterComma": true | ||
"requireSpaceAfterComma": { "allExcept": ["trailing"] }, | ||
"requireAlignedMultilineParams": false, | ||
"requireSpacesInGenerator": { | ||
"afterStar": true | ||
}, | ||
"disallowSpacesInGenerator": { | ||
"beforeStar": true | ||
}, | ||
"disallowVar": false, | ||
"requireArrayDestructuring": false, | ||
"requireEnhancedObjectLiterals": false, | ||
"requireObjectDestructuring": false, | ||
"requireEarlyReturn": false, | ||
"requireCapitalizedConstructorsNew": { | ||
"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"] | ||
}, | ||
"requireImportAlphabetized": false, | ||
"requireSpaceBeforeObjectValues": true, | ||
"requireSpaceBeforeDestructuredValues": true, | ||
"disallowSpacesInsideTemplateStringPlaceholders": true, | ||
"disallowArrayDestructuringReturn": false, | ||
"requireNewlineBeforeSingleStatementsInIf": false, | ||
"disallowUnusedVariables": true, | ||
"requireSpacesInsideImportedObjectBraces": true, | ||
"requireUseStrict": true | ||
} | ||
@@ -0,1 +1,10 @@ | ||
1.1.3 / 2018-08-14 | ||
================= | ||
* [Refactor] use a for loop instead of `foreach` to make for smaller bundle sizes | ||
* [Robustness] cache `Array.prototype.concat` and `Object.defineProperty` | ||
* [Deps] update `object-keys` | ||
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `nsp`, `tape`, `jscs`; remove unused eccheck script + dep | ||
* [Tests] use pretest/posttest for linting/security | ||
* [Tests] fix npm upgrades on older nodes | ||
1.1.2 / 2015-10-14 | ||
@@ -2,0 +11,0 @@ ================= |
26
index.js
'use strict'; | ||
var keys = require('object-keys'); | ||
var foreach = require('foreach'); | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
var toStr = Object.prototype.toString; | ||
var concat = Array.prototype.concat; | ||
var origDefineProperty = Object.defineProperty; | ||
@@ -16,6 +17,7 @@ var isFunction = function (fn) { | ||
try { | ||
Object.defineProperty(obj, 'x', { enumerable: false, value: obj }); | ||
/* eslint-disable no-unused-vars, no-restricted-syntax */ | ||
for (var _ in obj) { return false; } | ||
/* eslint-enable no-unused-vars, no-restricted-syntax */ | ||
origDefineProperty(obj, 'x', { enumerable: false, value: obj }); | ||
// eslint-disable-next-line no-unused-vars, no-restricted-syntax | ||
for (var _ in obj) { // jscs:ignore disallowUnusedVariables | ||
return false; | ||
} | ||
return obj.x === obj; | ||
@@ -26,3 +28,3 @@ } catch (e) { /* this is IE 8. */ | ||
}; | ||
var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported(); | ||
var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported(); | ||
@@ -34,3 +36,3 @@ var defineProperty = function (object, name, value, predicate) { | ||
if (supportsDescriptors) { | ||
Object.defineProperty(object, name, { | ||
origDefineProperty(object, name, { | ||
configurable: true, | ||
@@ -50,7 +52,7 @@ enumerable: false, | ||
if (hasSymbols) { | ||
props = props.concat(Object.getOwnPropertySymbols(map)); | ||
props = concat.call(props, Object.getOwnPropertySymbols(map)); | ||
} | ||
foreach(props, function (name) { | ||
defineProperty(object, name, map[name], predicates[name]); | ||
}); | ||
for (var i = 0; i < props.length; i += 1) { | ||
defineProperty(object, props[i], map[props[i]], predicates[props[i]]); | ||
} | ||
}; | ||
@@ -57,0 +59,0 @@ |
{ | ||
"name": "define-properties", | ||
"version": "1.1.2", | ||
"version": "1.1.3", | ||
"author": "Jordan Harband", | ||
@@ -9,10 +9,12 @@ "description": "Define multiple non-enumerable properties at once. Uses `Object.defineProperty` when available; falls back to standard assignment in older engines.", | ||
"scripts": { | ||
"test": "npm run lint && node test/index.js && npm run security", | ||
"pretest": "npm run --silent lint", | ||
"test": "npm run --silent tests-only", | ||
"posttest": "npm run --silent security", | ||
"tests-only": "node test/index.js", | ||
"coverage": "covert test/*.js", | ||
"coverage-quiet": "covert test/*.js --quiet", | ||
"lint": "npm run jscs && npm run eslint", | ||
"lint": "npm run --silent jscs && npm run --silent eslint", | ||
"jscs": "jscs test/*.js *.js", | ||
"eslint": "eslint test/*.js *.js", | ||
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null", | ||
"security": "nsp package" | ||
"security": "nsp check" | ||
}, | ||
@@ -33,13 +35,11 @@ "repository": { | ||
"dependencies": { | ||
"foreach": "^2.0.5", | ||
"object-keys": "^1.0.8" | ||
"object-keys": "^1.0.12" | ||
}, | ||
"devDependencies": { | ||
"tape": "^4.2.1", | ||
"@ljharb/eslint-config": "^13.0.0", | ||
"covert": "^1.1.0", | ||
"jscs": "^2.3.1", | ||
"editorconfig-tools": "^0.1.1", | ||
"nsp": "^1.1.0", | ||
"eslint": "^1.6.0", | ||
"@ljharb/eslint-config": "^1.3.0" | ||
"eslint": "^5.3.0", | ||
"jscs": "^3.0.7", | ||
"nsp": "^3.2.1", | ||
"tape": "^4.9.0" | ||
}, | ||
@@ -68,2 +68,1 @@ "testling": { | ||
} | ||
@@ -18,6 +18,5 @@ 'use strict'; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
test('defineProperties', function (dt) { | ||
dt.test('with descriptor support', { skip: !descriptorsSupported }, function (t) { | ||
@@ -24,0 +23,0 @@ var getDescriptor = function (value) { |
Sorry, the diff of this file is not supported yet
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
23025
1
6
273
10
- Removedforeach@^2.0.5
- Removedforeach@2.0.6(transitive)
Updatedobject-keys@^1.0.12