Initial Save

This commit is contained in:
jackbeeby
2025-03-28 12:30:19 +11:00
parent e381994f19
commit d8773925e8
9910 changed files with 982718 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
root = true
[*]
indent_style = tab;
insert_final_newline = true;
quote_type = auto;
space_after_anonymous_functions = true;
space_after_control_statements = true;
spaces_around_operators = true;
trim_trailing_whitespace = true;
spaces_in_brackets = false;
end_of_line = lf;

View File

@@ -0,0 +1,27 @@
{
"root": true,
"extends": "@ljharb",
"rules": {
"id-length": [2, { "min": 1, "max": 30 }],
"new-cap": [2, {
"capIsNewExceptions": [
"CreateDataProperty",
"IsCallable",
"RequireObjectCoercible",
"ToObject",
]
}],
},
"overrides": [
{
"files": "test/**",
"rules": {
"max-lines-per-function": 0,
"no-invalid-this": 1
},
},
],
}

9
node_modules/object.getownpropertydescriptors/.nycrc generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"all": true,
"check-coverage": false,
"reporter": ["text-summary", "text", "html", "json"],
"exclude": [
"coverage",
"test"
]
}

View File

@@ -0,0 +1,141 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [v2.1.8](https://github.com/ljharb/Object.getOwnPropertyDescriptors/compare/v2.1.7...v2.1.8) - 2024-03-19
### Commits
- [actions] remove redundant finisher [`72e367f`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/72e367f708417284e465acb722ccaa0cff615a32)
- [Refactor] use `es-object-atoms` where possible [`a403fd2`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/a403fd2d4651586309b3a31a31010ca74fa5aa47)
- [Deps] update `call-bind`, `define-properties`, `es-abstract`, `safe-array-concat` [`fe4f40d`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/fe4f40d06ad1b877b1dd5aecb2e61c6d1c155c21)
- [Refactor] use `gopd` [`a2d1344`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/a2d1344271aa98bd9aa5771ea8847605628bcf6e)
- [Dev Deps] update `aud`, `mock-property`, `npmignore`, `tape` [`1852646`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/18526463da3df02dbc688e6897ab262245f85d99)
## [v2.1.7](https://github.com/ljharb/Object.getOwnPropertyDescriptors/compare/v2.1.6...v2.1.7) - 2023-08-31
### Commits
- [Deps] update `array.prototype.reduce`, `es-abstract` [`a201ad2`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/a201ad21768bbd199c122fc8b51ded6667b07573)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`f174ab1`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/f174ab14b2a816abac871d10747b1fcff179f0d8)
## [v2.1.6](https://github.com/ljharb/Object.getOwnPropertyDescriptors/compare/v2.1.5...v2.1.6) - 2023-04-20
### Commits
- [Refactor] use `safe-array-concat` [`a717eb2`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/a717eb21bacdc01eaa17092fe93dd21e0c1ef320)
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `aud`, `tape` [`b08d70f`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/b08d70f9387aad6341d44d9216ffa36023973a66)
- [Deps] update `define-properties`, `es-abstract` [`95c8479`](https://github.com/ljharb/Object.getOwnPropertyDescriptors/commit/95c84794c2a78bc78c8c5f540db150c30fe9aea2)
<!-- auto-changelog-above -->
2.1.4 / 2022-05-19
=================
* [Fix] `Array.prototype.reduce` isnt present in ES3 engines
* [meta] use `npmignore` to autogenerate an npmignore file
* [Deps] update `define-properties`, `es-abstract`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `auto-changelog`, `functions-have-names`, `safe-publish-latest`, `tape`
* [Tests] use `mock-property`
* [actions] reuse common workflows
* [actions] update codecov uploader
2.1.3 / 2021-10-03
=================
* [readme] remove travis badge; add actions and codecov badges
* [Deps] update `es-abstract`
* [meta] use `prepublishOnly` script for npm 7+
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `aud`, `tape`
* [actions] update workflows
* [actions] use `node/install` instead of `node/run`; use `codecov` action
2.1.2 / 2021-02-20
=================
* [Deps] update `call-bind`, `es-abstract`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `functions-have-names`, `has-strict-mode`, `tape`
* [meta] do not publish github action workflow files
* [meta] gitignore coverage output
* [actions] update workflows
2.1.1 / 2020-11-26
=================
* [Fix] do not mutate the native function when present
* [Deps] update `es-abstract`; use `call-bind` where applicable
* [meta] remove unused Makefile and associated utilities
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `tape`, `functions-have-names`; add `aud`
* [actions] add Require Allow Edits workflow
* [actions] switch Automatic Rebase workflow to `pull_request_target` event
* [Tests] migrate tests to Github Actions
* [Tests] run `nyc` on all tests
* [Tests] add `implementation` test; run `es-shim-api` in postlint; use `tape` runner
* [Tests] only audit prod deps
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
* [Deps] update `es-abstract`
* [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `jscs`, `nsp`, `tape`, `semver`
* [Dev Deps] remove unused eccheck script + dep
* [Tests] up to `node` `v6.3`, `v5.12`, `v4.4`
* [Tests] use pretest/posttest for linting/security
* Update to stage 4
2.0.2 / 2016-01-27
=================
* [Fix] ensure that `Object.getOwnPropertyDescriptors` does not fail when `Object.prototype` has a poisoned setter (#1, #2)
2.0.1 / 2016-01-27
=================
* [Deps] move `@es-shims/api` to dev deps
2.0.0 / 2016-01-27
=================
* [Breaking] implement the es-shims API
* [Deps] update `define-properties`, `es-abstract`
* [Dev Deps] update `tape`, `jscs`, `nsp`, `eslint`, `@ljharb/eslint-config`, `semver`
* [Tests] fix npm upgrades in older nodes
* [Tests] up to `node` `v5.5`
* [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG
1.0.4 / 2015-07-20
=================
* [Tests] Test on `io.js` `v2.4`
* [Deps, Dev Deps] Update `define-properties`, `tape`, `eslint`, `semver`
1.0.3 / 2015-06-28
=================
* Increase robustness by caching `Array#{concat, reduce}`
* [Deps] Update `define_properties`
* [Dev Deps] Update `eslint`, `semver`, `nsp`
* [Tests] Test up to `io.js` `v2.3`
1.0.2 / 2015-05-23
=================
* Update `es-abstract`, `tape`, `eslint`, `jscs`, `semver`, `covert`
* Test up to `io.js` `v2.0`
1.0.1 / 2015-03-20
=================
* Update `es-abstract`, `editorconfig-tools`, `nsp`, `eslint`, `semver`, `replace`
1.0.0 / 2015-02-17
=================
* v1.0.0

22
node_modules/object.getownpropertydescriptors/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2015 Jordan Harband
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

100
node_modules/object.getownpropertydescriptors/README.md generated vendored Normal file
View File

@@ -0,0 +1,100 @@
# object.getownpropertydescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![dependency status][deps-svg]][deps-url]
[![dev dependency status][dev-deps-svg]][dev-deps-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url]
[![npm badge][npm-badge-png]][package-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.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://github.com/tc39/ecma262/pull/582).
## Example
```js
var getDescriptors = require('object.getownpropertydescriptors');
var assert = require('assert');
var obj = { normal: Infinity };
var enumDescriptor = {
enumerable: false,
writable: false,
configurable: true,
value: true
};
var writableDescriptor = {
enumerable: true,
writable: true,
configurable: true,
value: 42
};
var symbol = Symbol();
var symDescriptor = {
enumerable: true,
writable: true,
configurable: false,
value: [symbol]
};
Object.defineProperty(obj, 'enumerable', enumDescriptor);
Object.defineProperty(obj, 'writable', writableDescriptor);
Object.defineProperty(obj, 'symbol', symDescriptor);
var descriptors = getDescriptors(obj);
assert.deepEqual(descriptors, {
normal: {
enumerable: true,
writable: true,
configurable: true,
value: Infinity
},
enumerable: enumDescriptor,
writable: writableDescriptor,
symbol: symDescriptor
});
```
```js
var getDescriptors = require('object.getownpropertydescriptors');
var assert = require('assert');
/* when Object.getOwnPropertyDescriptors is not present */
delete Object.getOwnPropertyDescriptors;
var shimmedDescriptors = getDescriptors.shim();
assert.equal(shimmedDescriptors, getDescriptors);
assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));
```
```js
var getDescriptors = require('object.getownpropertydescriptors');
var assert = require('assert');
/* when Object.getOwnPropertyDescriptors is present */
var shimmedDescriptors = getDescriptors.shim();
assert.notEqual(shimmedDescriptors, getDescriptors);
assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));
```
## Tests
Simply clone the repo, `npm install`, and run `npm test`
[package-url]: https://npmjs.org/package/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
[downloads-image]: http://img.shields.io/npm/dm/object.getownpropertydescriptors.svg
[downloads-url]: http://npm-stat.com/charts.html?package=object.getownpropertydescriptors
[codecov-image]: https://codecov.io/gh/es-shims/Object.getOwnPropertyDescriptors/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Object.getOwnPropertyDescriptors/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Object.getOwnPropertyDescriptors
[actions-url]: https://github.com/es-shims/Object.getOwnPropertyDescriptors/actions

View File

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

View File

@@ -0,0 +1,38 @@
'use strict';
var CreateDataProperty = require('es-abstract/2024/CreateDataProperty');
var RequireObjectCoercible = require('es-object-atoms/RequireObjectCoercible');
var ToObject = require('es-object-atoms/ToObject');
var safeConcat = require('safe-array-concat');
var reduce = require('array.prototype.reduce');
var gOPD = require('gopd');
var $Object = require('es-object-atoms');
var $getOwnNames = $Object.getOwnPropertyNames;
var $getSymbols = $Object.getOwnPropertySymbols;
var getAll = $getSymbols ? function (obj) {
return safeConcat($getOwnNames(obj), $getSymbols(obj));
} : $getOwnNames;
var isES5 = gOPD && typeof $getOwnNames === 'function';
module.exports = function getOwnPropertyDescriptors(value) {
RequireObjectCoercible(value);
if (!isES5) {
throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor');
}
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;
},
{}
);
};

18
node_modules/object.getownpropertydescriptors/index.js generated vendored Normal file
View File

@@ -0,0 +1,18 @@
'use strict';
var define = require('define-properties');
var callBind = require('call-bind');
var implementation = require('./implementation');
var getPolyfill = require('./polyfill');
var shim = require('./shim');
var bound = callBind(getPolyfill(), Object);
define(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;

View File

@@ -0,0 +1,101 @@
{
"name": "object.getownpropertydescriptors",
"version": "2.1.8",
"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.",
"license": "MIT",
"main": "index.js",
"scripts": {
"prepack": "npmignore --auto --commentLines=autogenerated",
"prepublish": "not-in-publish || npm run prepublishOnly",
"prepublishOnly": "safe-publish-latest",
"pretest": "npm run --silent lint",
"test": "npm run --silent tests-only",
"posttest": "aud --production",
"tests-only": "nyc tape 'test/**/*.js'",
"lint": "eslint --ext=js,mjs .",
"postlint": "es-shim-api --bound",
"version": "auto-changelog && git add CHANGELOG.md",
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
},
"repository": {
"type": "git",
"url": "git://github.com/es-shims/object.getownpropertydescriptors.git"
},
"keywords": [
"Object.getOwnPropertyDescriptors",
"descriptor",
"property descriptor",
"ES8",
"ES2017",
"shim",
"polyfill",
"getOwnPropertyDescriptor",
"es-shim API"
],
"dependencies": {
"array.prototype.reduce": "^1.0.6",
"call-bind": "^1.0.7",
"define-properties": "^1.2.1",
"es-abstract": "^1.23.2",
"es-object-atoms": "^1.0.0",
"gopd": "^1.0.1",
"safe-array-concat": "^1.1.2"
},
"devDependencies": {
"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.4",
"auto-changelog": "^2.4.0",
"eslint": "=8.8.0",
"functions-have-names": "^1.2.3",
"has-strict-mode": "^1.0.1",
"in-publish": "^2.0.1",
"mock-property": "^1.0.3",
"npmignore": "^0.3.1",
"nyc": "^10.3.2",
"safe-publish-latest": "^2.0.0",
"tape": "^5.7.5"
},
"testling": {
"files": [
"test/index.js",
"test/shimmed.js"
],
"browsers": [
"iexplore/9.0..latest",
"firefox/4.0..6.0",
"firefox/15.0..latest",
"firefox/nightly",
"chrome/5.0..10.0",
"chrome/20.0..latest",
"chrome/canary",
"opera/12.0..latest",
"opera/next",
"safari/5.0..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2"
]
},
"engines": {
"node": ">= 0.8"
},
"auto-changelog": {
"output": "CHANGELOG.md",
"template": "keepachangelog",
"unreleased": false,
"commitLimit": false,
"backfillLimit": false,
"hideCredit": true,
"startingVersion": "2.1.6"
},
"publishConfig": {
"ignore": [
".github/workflows"
]
}
}

View File

@@ -0,0 +1,7 @@
'use strict';
var implementation = require('./implementation');
module.exports = function getPolyfill() {
return typeof Object.getOwnPropertyDescriptors === 'function' ? Object.getOwnPropertyDescriptors : implementation;
};

14
node_modules/object.getownpropertydescriptors/shim.js generated vendored Normal file
View File

@@ -0,0 +1,14 @@
'use strict';
var getPolyfill = require('./polyfill');
var define = require('define-properties');
module.exports = function shimGetOwnPropertyDescriptors() {
var polyfill = getPolyfill();
define(
Object,
{ getOwnPropertyDescriptors: polyfill },
{ getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill; } }
);
return polyfill;
};

View File

@@ -0,0 +1,20 @@
'use strict';
var implementation = require('../implementation');
var callBind = require('call-bind');
var test = require('tape');
var hasStrictMode = require('has-strict-mode')();
var runTests = require('./tests');
test('as a function', function (t) {
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
/* eslint no-useless-call: 0 */
st['throws'](function () { implementation.call(undefined); }, TypeError, 'undefined is not an object');
st['throws'](function () { implementation.call(null); }, TypeError, 'null is not an object');
st.end();
});
runTests(callBind(implementation, Object), t);
t.end();
});

View File

@@ -0,0 +1,17 @@
'use strict';
var getDescriptors = require('../');
var test = require('tape');
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.end();
});
runTests(getDescriptors, t);
t.end();
});

View File

@@ -0,0 +1,36 @@
'use strict';
require('../auto');
var getDescriptors = require('../');
var test = require('tape');
var defineProperties = require('define-properties');
var runTests = require('./tests');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
test('shimmed', function (t) {
t.equal(Object.getOwnPropertyDescriptors.length, 1, 'Object.getOwnPropertyDescriptors has a length of 1');
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
st.equal(Object.getOwnPropertyDescriptors.name, 'getOwnPropertyDescriptors', 'Object.getOwnPropertyDescriptors has name "getOwnPropertyDescriptors"');
st.end();
});
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
et.equal(false, isEnumerable.call(Object, 'getOwnPropertyDescriptors'), 'Object.getOwnPropertyDescriptors is not enumerable');
et.end();
});
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.end();
});
runTests(Object.getOwnPropertyDescriptors, t);
t.end();
});

View File

@@ -0,0 +1,121 @@
'use strict';
var mockProperty = require('mock-property');
module.exports = function (getDescriptors, t) {
var enumDescriptor = {
configurable: true,
enumerable: false,
value: true,
writable: false
};
var writableDescriptor = {
configurable: true,
enumerable: true,
value: 42,
writable: true
};
t.test('works with Object.prototype poisoned setter', { skip: !Object.defineProperty }, function (st) {
var key = 'foo';
var obj = {};
obj[key] = 42;
var expected = {};
expected[key] = {
configurable: true,
enumerable: true,
value: 42,
writable: true
};
st.teardown(mockProperty(Object.prototype, key, { set: function (v) { throw new Error(v); } }));
var hasOwnNamesBug = false;
try {
Object.getOwnPropertyNames(obj);
} catch (e) {
// v8 in node 0.6 - 0.12 has a bug :-(
hasOwnNamesBug = true;
st.comment('SKIP: this engine has a bug with Object.getOwnPropertyNames: it can not handle a throwing setter on Object.prototype.');
}
if (!hasOwnNamesBug) {
st.doesNotThrow(function () {
var result = getDescriptors(obj);
st.deepEqual(result, expected, 'got expected descriptors');
});
}
delete Object.prototype[key];
st.end();
});
t.test('gets all expected non-Symbol descriptors', function (st) {
var obj = { normal: Infinity };
Object.defineProperty(obj, 'enumerable', enumDescriptor);
Object.defineProperty(obj, 'writable', writableDescriptor);
var descriptors = getDescriptors(obj);
st.deepEqual(descriptors, {
enumerable: enumDescriptor,
normal: {
configurable: true,
enumerable: true,
value: Infinity,
writable: true
},
writable: writableDescriptor
});
st.end();
});
var supportsSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
t.test('gets Symbol descriptors too', { skip: !supportsSymbols }, function (st) {
var symbol = Symbol('sym');
var symDescriptor = {
configurable: false,
enumerable: true,
value: [symbol],
writable: true
};
var obj = { normal: Infinity };
Object.defineProperty(obj, 'enumerable', enumDescriptor);
Object.defineProperty(obj, 'writable', writableDescriptor);
Object.defineProperty(obj, 'symbol', symDescriptor);
var descriptors = getDescriptors(obj);
st.deepEqual(descriptors, {
enumerable: enumDescriptor,
normal: {
configurable: true,
enumerable: true,
value: Infinity,
writable: true
},
symbol: symDescriptor,
writable: writableDescriptor
});
st.end();
});
var supportsProxy = typeof Proxy === 'function';
t.test('Proxies that return an undefined descriptor', { skip: !supportsProxy }, function (st) {
var obj = { foo: true };
var fooDescriptor = Object.getOwnPropertyDescriptor(obj, 'foo');
var proxy = new Proxy(obj, {
getOwnPropertyDescriptor: function (target, key) {
return Object.getOwnPropertyDescriptor(target, key);
},
ownKeys: function () {
return ['foo', 'bar'];
}
});
st.deepEqual(getDescriptors(proxy), { foo: fooDescriptor }, 'object has no descriptors');
st.end();
});
};