object.getownpropertydescriptors
Advanced tools
| name: Automatic Rebase | ||
| on: [pull_request] | ||
| jobs: | ||
| _: | ||
| name: "Automatic Rebase" | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v1 | ||
| - uses: ljharb/rebase@master | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
+3
| 'use strict'; | ||
| require('./shim')(); |
+12
-2
@@ -8,4 +8,14 @@ { | ||
| "id-length": [2, { "min": 1, "max": 30 }], | ||
| "new-cap": [2, { "capIsNewExceptions": ["IsCallable", "RequireObjectCoercible", "ToObject"] }] | ||
| } | ||
| "new-cap": [2, { "capIsNewExceptions": ["CreateDataProperty", "IsCallable", "RequireObjectCoercible", "ToObject"] }] | ||
| }, | ||
| "overrides": [ | ||
| { | ||
| "files": "test/**", | ||
| "rules": { | ||
| "max-lines-per-function": 0, | ||
| "no-invalid-this": 1 | ||
| }, | ||
| }, | ||
| ], | ||
| } |
+9
-93
@@ -0,96 +1,12 @@ | ||
| version: ~> 1.0 | ||
| language: node_js | ||
| node_js: | ||
| - "6.2" | ||
| - "6.1" | ||
| - "6.0" | ||
| - "5.12" | ||
| - "5.11" | ||
| - "5.10" | ||
| - "5.9" | ||
| - "5.8" | ||
| - "5.7" | ||
| - "5.6" | ||
| - "5.5" | ||
| - "5.4" | ||
| - "5.3" | ||
| - "5.2" | ||
| - "5.1" | ||
| - "5.0" | ||
| - "4.4" | ||
| - "4.3" | ||
| - "4.2" | ||
| - "4.1" | ||
| - "4.0" | ||
| - "iojs-v3.3" | ||
| - "iojs-v3.2" | ||
| - "iojs-v3.1" | ||
| - "iojs-v3.0" | ||
| - "iojs-v2.5" | ||
| - "iojs-v2.4" | ||
| - "iojs-v2.3" | ||
| - "iojs-v2.2" | ||
| - "iojs-v2.1" | ||
| - "iojs-v2.0" | ||
| - "iojs-v1.8" | ||
| - "iojs-v1.7" | ||
| - "iojs-v1.6" | ||
| - "iojs-v1.5" | ||
| - "iojs-v1.4" | ||
| - "iojs-v1.3" | ||
| - "iojs-v1.2" | ||
| - "iojs-v1.1" | ||
| - "iojs-v1.0" | ||
| - "0.12" | ||
| - "0.11" | ||
| - "0.10" | ||
| - "0.9" | ||
| - "0.8" | ||
| - "0.6" | ||
| - "0.4" | ||
| before_install: | ||
| - 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' | ||
| - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' | ||
| script: | ||
| - 'if [ "${TRAVIS_NODE_VERSION}" != "4.4" ]; then npm run tests-only ; else npm test ; fi' | ||
| sudo: false | ||
| os: | ||
| - linux | ||
| import: | ||
| - ljharb/travis-ci:node/all.yml | ||
| - ljharb/travis-ci:node/pretest.yml | ||
| - ljharb/travis-ci:node/posttest.yml | ||
| - ljharb/travis-ci:node/coverage.yml | ||
| matrix: | ||
| fast_finish: true | ||
| allow_failures: | ||
| - node_js: "6.1" | ||
| - node_js: "6.0" | ||
| - node_js: "5.11" | ||
| - node_js: "5.10" | ||
| - node_js: "5.9" | ||
| - node_js: "5.8" | ||
| - node_js: "5.7" | ||
| - node_js: "5.6" | ||
| - node_js: "5.5" | ||
| - node_js: "5.4" | ||
| - node_js: "5.3" | ||
| - node_js: "5.2" | ||
| - node_js: "5.1" | ||
| - node_js: "5.0" | ||
| - node_js: "4.3" | ||
| - node_js: "4.2" | ||
| - node_js: "4.1" | ||
| - node_js: "4.0" | ||
| - node_js: "iojs-v3.2" | ||
| - node_js: "iojs-v3.1" | ||
| - node_js: "iojs-v3.0" | ||
| - node_js: "iojs-v2.4" | ||
| - node_js: "iojs-v2.3" | ||
| - node_js: "iojs-v2.2" | ||
| - node_js: "iojs-v2.1" | ||
| - node_js: "iojs-v2.0" | ||
| - node_js: "iojs-v1.7" | ||
| - node_js: "iojs-v1.6" | ||
| - node_js: "iojs-v1.5" | ||
| - node_js: "iojs-v1.4" | ||
| - node_js: "iojs-v1.3" | ||
| - node_js: "iojs-v1.2" | ||
| - node_js: "iojs-v1.1" | ||
| - node_js: "iojs-v1.0" | ||
| - node_js: "0.11" | ||
| - node_js: "0.9" | ||
| - node_js: "0.6" | ||
| - node_js: "0.4" | ||
| - env: COVERAGE=true |
+16
-0
@@ -0,1 +1,17 @@ | ||
| 2.1.0 / 2019-12-12 | ||
| ================= | ||
| * [New] add auto entry point | ||
| * [Refactor] use split-up `es-abstract` (78% bundle size decrease) | ||
| * [readme] fix repo URLs, remove testling | ||
| * [Docs] Fix formatting in the README (#30) | ||
| * [Deps] update `define-properties`, `es-abstract` | ||
| * [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `functions-have-names`, `covert`, `replace`, `semver`, `tape`, `@es-shims/api`; add `safe-publish-latest` | ||
| * [meta] add `funding` field | ||
| * [meta] Only apps should have lockfiles. | ||
| * [Tests] use shared travis-ci configs | ||
| * [Tests] use `functions-have-names` | ||
| * [Tests] use `npx aud` instead of `nsp` or `npm audit` with hoops | ||
| * [Tests] remove `jscs` | ||
| * [actions] add automatic rebasing / merge commit blocking | ||
| 2.0.3 / 2016-07-26 | ||
@@ -2,0 +18,0 @@ ================= |
+27
-33
| 'use strict'; | ||
| var ES = require('es-abstract/es7'); | ||
| var CreateDataProperty = require('es-abstract/2019/CreateDataProperty'); | ||
| var IsCallable = require('es-abstract/2019/IsCallable'); | ||
| var RequireObjectCoercible = require('es-abstract/2019/RequireObjectCoercible'); | ||
| var ToObject = require('es-abstract/2019/ToObject'); | ||
| var callBound = require('es-abstract/helpers/callBound'); | ||
| var defineProperty = Object.defineProperty; | ||
| var getDescriptor = Object.getOwnPropertyDescriptor; | ||
| var getOwnNames = Object.getOwnPropertyNames; | ||
| var getSymbols = Object.getOwnPropertySymbols; | ||
| var concat = Function.call.bind(Array.prototype.concat); | ||
| var reduce = Function.call.bind(Array.prototype.reduce); | ||
| var getAll = getSymbols ? function (obj) { | ||
| return concat(getOwnNames(obj), getSymbols(obj)); | ||
| } : getOwnNames; | ||
| var $gOPD = Object.getOwnPropertyDescriptor; | ||
| var $getOwnNames = Object.getOwnPropertyNames; | ||
| var $getSymbols = Object.getOwnPropertySymbols; | ||
| var $concat = callBound('Array.prototype.concat'); | ||
| var $reduce = callBound('Array.prototype.reduce'); | ||
| var getAll = $getSymbols ? function (obj) { | ||
| return $concat($getOwnNames(obj), $getSymbols(obj)); | ||
| } : $getOwnNames; | ||
| var isES5 = ES.IsCallable(getDescriptor) && ES.IsCallable(getOwnNames); | ||
| var isES5 = IsCallable($gOPD) && IsCallable($getOwnNames); | ||
| var safePut = function put(obj, prop, val) { // eslint-disable-line max-params | ||
| if (defineProperty && prop in obj) { | ||
| defineProperty(obj, prop, { | ||
| configurable: true, | ||
| enumerable: true, | ||
| value: val, | ||
| writable: true | ||
| }); | ||
| } else { | ||
| obj[prop] = val; | ||
| } | ||
| }; | ||
| module.exports = function getOwnPropertyDescriptors(value) { | ||
| ES.RequireObjectCoercible(value); | ||
| RequireObjectCoercible(value); | ||
| if (!isES5) { | ||
@@ -36,10 +26,14 @@ throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor'); | ||
| var O = ES.ToObject(value); | ||
| return reduce(getAll(O), function (acc, key) { | ||
| var descriptor = getDescriptor(O, key); | ||
| if (typeof descriptor !== 'undefined') { | ||
| safePut(acc, key, descriptor); | ||
| } | ||
| return acc; | ||
| }, {}); | ||
| var O = ToObject(value); | ||
| return $reduce( | ||
| getAll(O), | ||
| function (acc, key) { | ||
| var descriptor = $gOPD(O, key); | ||
| if (typeof descriptor !== 'undefined') { | ||
| CreateDataProperty(acc, key, descriptor); | ||
| } | ||
| return acc; | ||
| }, | ||
| {} | ||
| ); | ||
| }; |
+23
-23
| { | ||
| "name": "object.getownpropertydescriptors", | ||
| "version": "2.0.3", | ||
| "author": "Jordan Harband", | ||
| "version": "2.1.0", | ||
| "author": "Jordan Harband <ljharb@gmail.com>", | ||
| "funding": { | ||
| "url": "https://github.com/sponsors/ljharb" | ||
| }, | ||
| "description": "ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.", | ||
@@ -9,18 +12,16 @@ "license": "MIT", | ||
| "scripts": { | ||
| "pretest": "npm run --silent lint && es-shim-api", | ||
| "prepublish": "safe-publish-latest", | ||
| "pretest": "npm run --silent lint && es-shim-api --bound", | ||
| "test": "npm run --silent tests-only", | ||
| "posttest": "npm run --silent security", | ||
| "posttest": "npx aud", | ||
| "tests-only": "npm run --silent test:shimmed && npm run --silent test:module", | ||
| "test:shimmed": "node test/shimmed.js", | ||
| "test:module": "node test/index.js", | ||
| "test:shimmed": "node test/shimmed", | ||
| "test:module": "node test", | ||
| "coverage": "covert test/*.js", | ||
| "coverage:quiet": "covert test/*.js --quiet", | ||
| "lint": "npm run --silent jscs && npm run --silent eslint", | ||
| "jscs": "jscs test/*.js *.js", | ||
| "eslint": "eslint test/*.js *.js", | ||
| "security": "nsp check" | ||
| "lint": "eslint ." | ||
| }, | ||
| "repository": { | ||
| "type": "git", | ||
| "url": "git://github.com/ljharb/object.getownpropertydescriptors.git" | ||
| "url": "git://github.com/es-shims/object.getownpropertydescriptors.git" | ||
| }, | ||
@@ -39,15 +40,15 @@ "keywords": [ | ||
| "dependencies": { | ||
| "define-properties": "^1.1.2", | ||
| "es-abstract": "^1.5.1" | ||
| "define-properties": "^1.1.3", | ||
| "es-abstract": "^1.17.0-next.1" | ||
| }, | ||
| "devDependencies": { | ||
| "tape": "^4.6.0", | ||
| "covert": "^1.1.0", | ||
| "jscs": "^3.0.7", | ||
| "nsp": "^2.6.1", | ||
| "eslint": "^3.1.1", | ||
| "@ljharb/eslint-config": "^6.0.0", | ||
| "semver": "^5.3.0", | ||
| "replace": "^0.3.0", | ||
| "@es-shims/api": "^1.2.0" | ||
| "@es-shims/api": "^2.1.2", | ||
| "@ljharb/eslint-config": "^15.0.2", | ||
| "covert": "^1.1.1", | ||
| "eslint": "^6.7.2", | ||
| "functions-have-names": "^1.2.0", | ||
| "replace": "^1.1.1", | ||
| "safe-publish-latest": "^1.1.4", | ||
| "semver": "^6.3.0", | ||
| "tape": "^4.11.0" | ||
| }, | ||
@@ -79,2 +80,1 @@ "testling": { | ||
| } | ||
+8
-12
@@ -1,2 +0,2 @@ | ||
| #object.getownpropertydescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
| # Object.getOwnPropertyDescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
@@ -11,4 +11,2 @@ [![Build Status][travis-svg]][travis-url] | ||
| [![browser support][testling-svg]][testling-url] | ||
| An ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5. | ||
@@ -87,11 +85,9 @@ Invoke its "shim" method to shim `Object.getOwnPropertyDescriptors` if it is unavailable, and if `Object.getOwnPropertyDescriptor` is available. | ||
| [package-url]: https://npmjs.org/package/object.getownpropertydescriptors | ||
| [npm-version-svg]: http://versionbadg.es/ljharb/object.getownpropertydescriptors.svg | ||
| [travis-svg]: https://travis-ci.org/ljharb/object.getownpropertydescriptors.svg | ||
| [travis-url]: https://travis-ci.org/ljharb/object.getownpropertydescriptors | ||
| [deps-svg]: https://david-dm.org/ljharb/object.getownpropertydescriptors.svg | ||
| [deps-url]: https://david-dm.org/ljharb/object.getownpropertydescriptors | ||
| [dev-deps-svg]: https://david-dm.org/ljharb/object.getownpropertydescriptors/dev-status.svg | ||
| [dev-deps-url]: https://david-dm.org/ljharb/object.getownpropertydescriptors#info=devDependencies | ||
| [testling-svg]: https://ci.testling.com/ljharb/object.getownpropertydescriptors.png | ||
| [testling-url]: https://ci.testling.com/ljharb/object.getownpropertydescriptors | ||
| [npm-version-svg]: http://versionbadg.es/es-shims/object.getownpropertydescriptors.svg | ||
| [travis-svg]: https://travis-ci.org/es-shims/Object.getOwnPropertyDescriptors.svg | ||
| [travis-url]: https://travis-ci.org/es-shims/Object.getOwnPropertyDescriptors | ||
| [deps-svg]: https://david-dm.org/es-shims/object.getownpropertydescriptors.svg | ||
| [deps-url]: https://david-dm.org/es-shims/object.getownpropertydescriptors | ||
| [dev-deps-svg]: https://david-dm.org/es-shims/object.getownpropertydescriptors/dev-status.svg | ||
| [dev-deps-url]: https://david-dm.org/es-shims/object.getownpropertydescriptors#info=devDependencies | ||
| [npm-badge-png]: https://nodei.co/npm/object.getownpropertydescriptors.png?downloads=true&stars=true | ||
@@ -98,0 +94,0 @@ [license-image]: http://img.shields.io/npm/l/object.getownpropertydescriptors.svg |
+2
-2
@@ -9,4 +9,4 @@ 'use strict'; | ||
| t.test('bad object/this value', function (st) { | ||
| st.throws(function () { return getDescriptors(undefined); }, TypeError, 'undefined is not an object'); | ||
| st.throws(function () { return getDescriptors(null); }, TypeError, 'null is not an object'); | ||
| st['throws'](function () { return getDescriptors(undefined); }, TypeError, 'undefined is not an object'); | ||
| st['throws'](function () { return getDescriptors(null); }, TypeError, 'null is not an object'); | ||
| st.end(); | ||
@@ -13,0 +13,0 @@ }); |
+3
-3
@@ -10,3 +10,3 @@ 'use strict'; | ||
| var isEnumerable = Object.prototype.propertyIsEnumerable; | ||
| var functionsHaveNames = function f() {}.name === 'f'; | ||
| var functionsHaveNames = require('functions-have-names')(); | ||
@@ -28,4 +28,4 @@ test('shimmed', function (t) { | ||
| t.test('bad object/this value', { skip: !supportsStrictMode }, function (st) { | ||
| st.throws(function () { return getDescriptors(undefined, 'a'); }, TypeError, 'undefined is not an object'); | ||
| st.throws(function () { return getDescriptors(null, 'a'); }, TypeError, 'null is not an object'); | ||
| st['throws'](function () { return getDescriptors(undefined, 'a'); }, TypeError, 'undefined is not an object'); | ||
| st['throws'](function () { return getDescriptors(null, 'a'); }, TypeError, 'null is not an object'); | ||
| st.end(); | ||
@@ -32,0 +32,0 @@ }); |
+3
-8
@@ -51,5 +51,3 @@ 'use strict'; | ||
| /* eslint-disable no-extend-native */ | ||
| delete Object.prototype[key]; | ||
| /* eslint-enable no-extend-native */ | ||
| st.end(); | ||
@@ -78,5 +76,5 @@ }); | ||
| var supportsSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol'; | ||
| var supportsSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol'; | ||
| t.test('gets Symbol descriptors too', { skip: !supportsSymbols }, function (st) { | ||
| var symbol = Symbol(); | ||
| var symbol = Symbol('sym'); | ||
| var symDescriptor = { | ||
@@ -120,6 +118,3 @@ configurable: false, | ||
| ownKeys: function () { | ||
| return [ | ||
| 'foo', | ||
| 'bar' | ||
| ]; | ||
| return ['foo', 'bar']; | ||
| } | ||
@@ -126,0 +121,0 @@ }); |
-176
| { | ||
| "es3": true, | ||
| "additionalRules": [], | ||
| "requireSemicolons": true, | ||
| "disallowMultipleSpaces": true, | ||
| "disallowIdentifierNames": [], | ||
| "requireCurlyBraces": { | ||
| "allExcept": [], | ||
| "keywords": ["if", "else", "for", "while", "do", "try", "catch"] | ||
| }, | ||
| "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], | ||
| "disallowSpaceAfterKeywords": [], | ||
| "disallowSpaceBeforeComma": true, | ||
| "disallowSpaceAfterComma": false, | ||
| "disallowSpaceBeforeSemicolon": true, | ||
| "disallowNodeTypes": [ | ||
| "DebuggerStatement", | ||
| "ForInStatement", | ||
| "LabeledStatement", | ||
| "SwitchCase", | ||
| "SwitchStatement", | ||
| "WithStatement" | ||
| ], | ||
| "requireObjectKeysOnNewLine": { "allExcept": ["sameLine"] }, | ||
| "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, | ||
| "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, | ||
| "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, | ||
| "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, | ||
| "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, | ||
| "requireSpaceBetweenArguments": true, | ||
| "disallowSpacesInsideParentheses": true, | ||
| "disallowSpacesInsideArrayBrackets": true, | ||
| "disallowQuotedKeysInObjects": { "allExcept": ["reserved"] }, | ||
| "disallowSpaceAfterObjectKeys": true, | ||
| "requireCommaBeforeLineBreak": true, | ||
| "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], | ||
| "requireSpaceAfterPrefixUnaryOperators": [], | ||
| "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], | ||
| "requireSpaceBeforePostfixUnaryOperators": [], | ||
| "disallowSpaceBeforeBinaryOperators": [], | ||
| "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
| "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], | ||
| "disallowSpaceAfterBinaryOperators": [], | ||
| "disallowImplicitTypeConversion": ["binary", "string"], | ||
| "disallowKeywords": ["with", "eval"], | ||
| "requireKeywordsOnNewLine": [], | ||
| "disallowKeywordsOnNewLine": ["else"], | ||
| "requireLineFeedAtFileEnd": true, | ||
| "disallowTrailingWhitespace": true, | ||
| "disallowTrailingComma": true, | ||
| "excludeFiles": ["node_modules/**", "vendor/**"], | ||
| "disallowMultipleLineStrings": true, | ||
| "requireDotNotation": { "allExcept": ["keywords"] }, | ||
| "requireParenthesesAroundIIFE": true, | ||
| "validateLineBreaks": "LF", | ||
| "validateQuoteMarks": { | ||
| "escape": true, | ||
| "mark": "'" | ||
| }, | ||
| "disallowOperatorBeforeLineBreak": [], | ||
| "requireSpaceBeforeKeywords": [ | ||
| "do", | ||
| "for", | ||
| "if", | ||
| "else", | ||
| "switch", | ||
| "case", | ||
| "try", | ||
| "catch", | ||
| "finally", | ||
| "while", | ||
| "with", | ||
| "return" | ||
| ], | ||
| "validateAlignedFunctionParameters": { | ||
| "lineBreakAfterOpeningBraces": true, | ||
| "lineBreakBeforeClosingBraces": true | ||
| }, | ||
| "requirePaddingNewLinesBeforeExport": true, | ||
| "validateNewlineAfterArrayElements": { | ||
| "maximum": 1 | ||
| }, | ||
| "requirePaddingNewLinesAfterUseStrict": true, | ||
| "disallowArrowFunctions": true, | ||
| "disallowMultiLineTernary": true, | ||
| "validateOrderInObjectKeys": "asc-insensitive", | ||
| "disallowIdenticalDestructuringNames": true, | ||
| "disallowNestedTernaries": { "maxLevel": 1 }, | ||
| "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 | ||
| } | ||
Sorry, the diff of this file is not supported yet
| { | ||
| "rules": { | ||
| "max-nested-callbacks": [2, 3], | ||
| "max-statements": [2, 15], | ||
| "max-statements-per-line": [2, { "max": 2 }], | ||
| "no-invalid-this": [1] | ||
| } | ||
| } |
21141
-21.22%17
-5.56%209
-36.86%96
-4%Updated
Updated