This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -5,6 +5,16 @@
"rules": {
"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
},
},
],
}

View File

@@ -0,0 +1,15 @@
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 }}

View File

@@ -1,176 +0,0 @@
{
"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
}

View File

@@ -1,28 +0,0 @@
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov
# Coverage directory used by tools like istanbul
coverage
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release
# Dependency directory
# Commenting this out is preferred by some people, see
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
node_modules
# Users Environment Variables
.lock-wscript

View File

@@ -1,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

View File

@@ -1,3 +1,19 @@
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
=================
* [Fix] Update implementation to not return `undefined` descriptors

View File

@@ -1,4 +1,4 @@
#object.getownpropertydescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
# Object.getOwnPropertyDescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![Build Status][travis-svg]][travis-url]
[![dependency status][deps-svg]][deps-url]
@@ -8,8 +8,6 @@
[![npm badge][npm-badge-png]][package-url]
[![browser support][testling-svg]][testling-url]
An ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.
Invoke its "shim" method to shim `Object.getOwnPropertyDescriptors` if it is unavailable, and if `Object.getOwnPropertyDescriptor` is available.
@@ -83,15 +81,13 @@ assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));
Simply clone the repo, `npm install`, and run `npm test`
[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
[license-image]: http://img.shields.io/npm/l/object.getownpropertydescriptors.svg
[license-url]: LICENSE

View File

@@ -0,0 +1,3 @@
'use strict';
require('./shim')();

View File

@@ -1,44 +1,38 @@
'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 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;
}
};
var isES5 = IsCallable($gOPD) && IsCallable($getOwnNames);
module.exports = function getOwnPropertyDescriptors(value) {
ES.RequireObjectCoercible(value);
RequireObjectCoercible(value);
if (!isES5) {
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;
},
{}
);
};

View File

@@ -1,59 +1,59 @@
{
"_args": [
[
"object.getownpropertydescriptors@2.0.3",
"/Users/pjquirk/Source/GitHub/actions/labeler"
]
],
"_development": true,
"_from": "object.getownpropertydescriptors@2.0.3",
"_id": "object.getownpropertydescriptors@2.0.3",
"_from": "object.getownpropertydescriptors@^2.1.0",
"_id": "object.getownpropertydescriptors@2.1.0",
"_inBundle": false,
"_integrity": "sha1-h1jIRvW0B62rDyNuCYbxSwUcqhY=",
"_integrity": "sha512-Z53Oah9A3TdLoblT7VKJaTDdXdT+lQO+cNpKVnya5JDe9uLvzu1YyY1yFDFrcxrlRgWrEFH0jJtD/IbuwjcEVg==",
"_location": "/object.getownpropertydescriptors",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "object.getownpropertydescriptors@2.0.3",
"raw": "object.getownpropertydescriptors@^2.1.0",
"name": "object.getownpropertydescriptors",
"escapedName": "object.getownpropertydescriptors",
"rawSpec": "2.0.3",
"rawSpec": "^2.1.0",
"saveSpec": null,
"fetchSpec": "2.0.3"
"fetchSpec": "^2.1.0"
},
"_requiredBy": [
"/util.promisify"
],
"_resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.0.3.tgz",
"_spec": "2.0.3",
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
"_resolved": "https://registry.npmjs.org/object.getownpropertydescriptors/-/object.getownpropertydescriptors-2.1.0.tgz",
"_shasum": "369bf1f9592d8ab89d712dced5cb81c7c5352649",
"_spec": "object.getownpropertydescriptors@^2.1.0",
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/util.promisify",
"author": {
"name": "Jordan Harband"
"name": "Jordan Harband",
"email": "ljharb@gmail.com"
},
"bugs": {
"url": "https://github.com/ljharb/object.getownpropertydescriptors/issues"
"url": "https://github.com/es-shims/object.getownpropertydescriptors/issues"
},
"bundleDependencies": false,
"dependencies": {
"define-properties": "^1.1.2",
"es-abstract": "^1.5.1"
"define-properties": "^1.1.3",
"es-abstract": "^1.17.0-next.1"
},
"deprecated": false,
"description": "ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.",
"devDependencies": {
"@es-shims/api": "^1.2.0",
"@ljharb/eslint-config": "^6.0.0",
"covert": "^1.1.0",
"eslint": "^3.1.1",
"jscs": "^3.0.7",
"nsp": "^2.6.1",
"replace": "^0.3.0",
"semver": "^5.3.0",
"tape": "^4.6.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"
},
"engines": {
"node": ">= 0.8"
},
"homepage": "https://github.com/ljharb/object.getownpropertydescriptors#readme",
"funding": {
"url": "https://github.com/sponsors/ljharb"
},
"homepage": "https://github.com/es-shims/object.getownpropertydescriptors#readme",
"keywords": [
"Object.getOwnPropertyDescriptors",
"descriptor",
@@ -70,20 +70,18 @@
"name": "object.getownpropertydescriptors",
"repository": {
"type": "git",
"url": "git://github.com/ljharb/object.getownpropertydescriptors.git"
"url": "git://github.com/es-shims/object.getownpropertydescriptors.git"
},
"scripts": {
"coverage": "covert test/*.js",
"coverage:quiet": "covert test/*.js --quiet",
"eslint": "eslint test/*.js *.js",
"jscs": "jscs test/*.js *.js",
"lint": "npm run --silent jscs && npm run --silent eslint",
"posttest": "npm run --silent security",
"pretest": "npm run --silent lint && es-shim-api",
"security": "nsp check",
"lint": "eslint .",
"posttest": "npx aud",
"prepublish": "safe-publish-latest",
"pretest": "npm run --silent lint && es-shim-api --bound",
"test": "npm run --silent tests-only",
"test:module": "node test/index.js",
"test:shimmed": "node test/shimmed.js",
"test:module": "node test",
"test:shimmed": "node test/shimmed",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module"
},
"testling": {
@@ -107,5 +105,5 @@
"android-browser/4.2"
]
},
"version": "2.0.3"
"version": "2.1.0"
}

View File

@@ -1,8 +0,0 @@
{
"rules": {
"max-nested-callbacks": [2, 3],
"max-statements": [2, 15],
"max-statements-per-line": [2, { "max": 2 }],
"no-invalid-this": [1]
}
}

View File

@@ -6,8 +6,8 @@ var runTests = require('./tests');
test('as a function', function (t) {
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();
});

View File

@@ -7,7 +7,7 @@ var test = require('tape');
var defineProperties = require('define-properties');
var runTests = require('./tests');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = function f() {}.name === 'f';
var functionsHaveNames = require('functions-have-names')();
test('shimmed', function (t) {
t.equal(Object.getOwnPropertyDescriptors.length, 1, 'Object.getOwnPropertyDescriptors has a length of 1');
@@ -24,8 +24,8 @@ test('shimmed', function (t) {
var supportsStrictMode = (function () { return typeof this === 'undefined'; }());
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();
});

View File

@@ -48,9 +48,7 @@ module.exports = function (getDescriptors, t) {
});
}
/* eslint-disable no-extend-native */
delete Object.prototype[key];
/* eslint-enable no-extend-native */
st.end();
});
@@ -74,9 +72,9 @@ module.exports = function (getDescriptors, t) {
st.end();
});
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 = {
configurable: false,
enumerable: true,
@@ -115,10 +113,7 @@ module.exports = function (getDescriptors, t) {
return Object.getOwnPropertyDescriptor(target, key);
},
ownKeys: function () {
return [
'foo',
'bar'
];
return ['foo', 'bar'];
}
});
st.deepEqual(getDescriptors(proxy), { foo: fooDescriptor }, 'object has no descriptors');