create project
This commit is contained in:
15
kitabcitab/node_modules/object.hasown/.eslintrc
generated
vendored
Normal file
15
kitabcitab/node_modules/object.hasown/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"new-cap": [2, {
|
||||
"capIsNewExceptions": [
|
||||
"HasOwnProperty",
|
||||
"ToObject",
|
||||
"ToPropertyKey",
|
||||
],
|
||||
}],
|
||||
},
|
||||
}
|
||||
12
kitabcitab/node_modules/object.hasown/.github/FUNDING.yml
generated
vendored
Normal file
12
kitabcitab/node_modules/object.hasown/.github/FUNDING.yml
generated
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ljharb]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: npm/object.hasown
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
9
kitabcitab/node_modules/object.hasown/.nycrc
generated
vendored
Normal file
9
kitabcitab/node_modules/object.hasown/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
47
kitabcitab/node_modules/object.hasown/CHANGELOG.md
generated
vendored
Normal file
47
kitabcitab/node_modules/object.hasown/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
# 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).
|
||||
|
||||
## [v1.1.2](https://github.com/es-shims/Object.hasOwn/compare/v1.1.1...v1.1.2) - 2022-11-06
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] update rebase action to use reusable workflow [`db8c17c`](https://github.com/es-shims/Object.hasOwn/commit/db8c17c46fc53ffa1ed402308949e27d4dc13ae6)
|
||||
- [Deps] update `es-abstract` [`8b549d2`](https://github.com/es-shims/Object.hasOwn/commit/8b549d28e1589e923d73b42516e2fa8cbdb358cb)
|
||||
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`25fc539`](https://github.com/es-shims/Object.hasOwn/commit/25fc539d426a6f01ad0bb8bc3593919316b88c89)
|
||||
|
||||
## [v1.1.1](https://github.com/es-shims/Object.hasOwn/compare/v1.1.0...v1.1.1) - 2022-05-05
|
||||
|
||||
### Commits
|
||||
|
||||
- [actions] remove unused actions [`4ca5814`](https://github.com/es-shims/Object.hasOwn/commit/4ca5814dc12ce990058574b84eccfdbe71e36506)
|
||||
- [actions] reuse common workflows [`e265a2f`](https://github.com/es-shims/Object.hasOwn/commit/e265a2f9c7a538acbe7d84f8d1373c9a22d0aaa7)
|
||||
- [meta] use `npmignore` to autogenerate an npmignore file [`4f54d5e`](https://github.com/es-shims/Object.hasOwn/commit/4f54d5e68bdbf390715138f1f228c51adb7e2d1d)
|
||||
- [Fix] `shim`: properly install when already present [`f580b50`](https://github.com/es-shims/Object.hasOwn/commit/f580b50b84aeced35eab728629cb0e2c3d734685)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `functions-have-names`, `has-symbols`, `tape` [`335d3c1`](https://github.com/es-shims/Object.hasOwn/commit/335d3c15429aa0936cdf8019d9ec7563cc362488)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `safe-publish-latest`, `tape` [`c040e94`](https://github.com/es-shims/Object.hasOwn/commit/c040e94ab5edce66787873d398c68c90c594e999)
|
||||
- [actions] update codecov uploader [`723dd15`](https://github.com/es-shims/Object.hasOwn/commit/723dd15c7fb49fef5c76fe95f14c2a1b32d3967d)
|
||||
- [Deps] update `define-properties`, `es-abstract` [`4fb99f9`](https://github.com/es-shims/Object.hasOwn/commit/4fb99f93fa493e134416fe8dfaaa8fd2db335ee6)
|
||||
- [Dev Deps] update `@ljharb/eslint-config` [`9a5e992`](https://github.com/es-shims/Object.hasOwn/commit/9a5e9921328858e359e6835d29f3a4349496aea2)
|
||||
|
||||
## [v1.1.0](https://github.com/es-shims/Object.hasOwn/compare/v1.0.0...v1.1.0) - 2021-10-03
|
||||
|
||||
### Commits
|
||||
|
||||
- [New] add ESM entry point [`8b8b4b2`](https://github.com/es-shims/Object.hasOwn/commit/8b8b4b22e22396b5ba080382c33e5844efbcf386)
|
||||
- [Tests] add implementation tests [`5edecfe`](https://github.com/es-shims/Object.hasOwn/commit/5edecfee70af78dee7d870e55c365e2b96dd449d)
|
||||
- [Deps] update `es-abstract` [`6ebc660`](https://github.com/es-shims/Object.hasOwn/commit/6ebc66079ca87f367b08051bf9b24e614b75d2f3)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `@es-shims/api`, `tape` [`e1832e2`](https://github.com/es-shims/Object.hasOwn/commit/e1832e2304dd40a899e07d50b50c603bb8a92844)
|
||||
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog` [`b1adc25`](https://github.com/es-shims/Object.hasOwn/commit/b1adc2505b0b19c6c21a4ea7cdab9655e2f146d4)
|
||||
- [Deps] update `es-abstract` [`1e7a06c`](https://github.com/es-shims/Object.hasOwn/commit/1e7a06cd73c2d980694908d5c5b204ae2c94bc70)
|
||||
- [Deps] update `es-abstract` [`622d71c`](https://github.com/es-shims/Object.hasOwn/commit/622d71c5168f5a863dd68833d760f882d5330aa7)
|
||||
|
||||
## v1.0.0 - 2021-05-25
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial package creation [`6f74bd8`](https://github.com/es-shims/Object.hasOwn/commit/6f74bd8cd669cd5964358ef85b51466baea34af7)
|
||||
- Initial commit [`cea8e05`](https://github.com/es-shims/Object.hasOwn/commit/cea8e058018ccd8ba31b15eebfe2b8181deb9946)
|
||||
21
kitabcitab/node_modules/object.hasown/LICENSE
generated
vendored
Normal file
21
kitabcitab/node_modules/object.hasown/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Glen Mailer, Jordan Harband, and contributors
|
||||
|
||||
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.
|
||||
51
kitabcitab/node_modules/object.hasown/README.md
generated
vendored
Normal file
51
kitabcitab/node_modules/object.hasown/README.md
generated
vendored
Normal file
@@ -0,0 +1,51 @@
|
||||
# object.hasown <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 ES spec-compliant `Object.hasOwn` shim. Invoke its "shim" method to shim `Object.hasOwn` if it is unavailable or noncompliant.
|
||||
|
||||
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://tc39.es/proposal-accessible-object-hasownproperty/).
|
||||
|
||||
Most common usage:
|
||||
```js
|
||||
var assert = require('assert');
|
||||
var hasOwn = require('object.hasown');
|
||||
|
||||
var obj = { a: 1, b: 2 };
|
||||
|
||||
assert(hasOwn(obj, 'a'));
|
||||
assert(hasOwn(obj, 'b'));
|
||||
assert('toString' in obj && !hasOwn(obj, 'toString'));
|
||||
|
||||
if (!Object.hasOwn) {
|
||||
hasOwn.shim();
|
||||
}
|
||||
|
||||
assert.deepEqual(Object.hasOwn(obj, 'a'), hasOwn(obj, 'a'));
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.com/package/object.hasown
|
||||
[npm-version-svg]: https://versionbadg.es/es-shims/Object.hasOwn.svg
|
||||
[deps-svg]: https://david-dm.org/es-shims/Object.hasOwn.svg
|
||||
[deps-url]: https://david-dm.org/es-shims/Object.hasOwn
|
||||
[dev-deps-svg]: https://david-dm.org/es-shims/Object.hasOwn/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/es-shims/Object.hasOwn#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/object.hasown.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/object.hasown.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/object.hasown.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=object.hasown
|
||||
[codecov-image]: https://codecov.io/gh/es-shims/Object.hasOwn/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/es-shims/Object.hasOwn/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Object.hasOwn
|
||||
[actions-url]: https://github.com/es-shims/Object.hasOwn/actions
|
||||
3
kitabcitab/node_modules/object.hasown/auto.js
generated
vendored
Normal file
3
kitabcitab/node_modules/object.hasown/auto.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
'use strict';
|
||||
|
||||
require('./shim')();
|
||||
11
kitabcitab/node_modules/object.hasown/implementation.js
generated
vendored
Normal file
11
kitabcitab/node_modules/object.hasown/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var ToObject = require('es-abstract/2022/ToObject');
|
||||
var ToPropertyKey = require('es-abstract/2022/ToPropertyKey');
|
||||
var HasOwnProperty = require('es-abstract/2022/HasOwnProperty');
|
||||
|
||||
module.exports = function hasOwn(O, P) {
|
||||
var obj = ToObject(O);
|
||||
var key = ToPropertyKey(P);
|
||||
return HasOwnProperty(obj, key);
|
||||
};
|
||||
18
kitabcitab/node_modules/object.hasown/index.js
generated
vendored
Normal file
18
kitabcitab/node_modules/object.hasown/index.js
generated
vendored
Normal 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 polyfill = callBind(getPolyfill(), null);
|
||||
|
||||
define(polyfill, {
|
||||
getPolyfill: getPolyfill,
|
||||
implementation: implementation,
|
||||
shim: shim
|
||||
});
|
||||
|
||||
module.exports = polyfill;
|
||||
9
kitabcitab/node_modules/object.hasown/index.mjs
generated
vendored
Normal file
9
kitabcitab/node_modules/object.hasown/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
import callBind from 'call-bind';
|
||||
|
||||
import getPolyfill from 'object.hasown/polyfill';
|
||||
|
||||
export default callBind(getPolyfill(), null);
|
||||
|
||||
export { default as getPolyfill } from 'object.hasown/polyfill';
|
||||
export { default as implementation } from 'object.hasown/implementation';
|
||||
export { default as shim } from 'object.hasown/shim';
|
||||
88
kitabcitab/node_modules/object.hasown/package.json
generated
vendored
Normal file
88
kitabcitab/node_modules/object.hasown/package.json
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
{
|
||||
"name": "object.hasown",
|
||||
"version": "1.1.2",
|
||||
"description": "ES spec-compliant shim for Object.hasOwn",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": [
|
||||
{
|
||||
"import": "./index.mjs",
|
||||
"require": "./index.js",
|
||||
"default": "./index.js"
|
||||
},
|
||||
"./index.js"
|
||||
],
|
||||
"./auto": "./auto.js",
|
||||
"./polyfill": "./polyfill.js",
|
||||
"./implementation": "./implementation.js",
|
||||
"./shim": "./shim.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "es-shim-api --bound",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape 'test/**/*.js'",
|
||||
"tests-esm": "nyc node test/index.mjs",
|
||||
"test": "npm run tests-only && npm run tests-esm",
|
||||
"posttest": "aud --production",
|
||||
"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": "https://github.com/es-shims/Object.hasOwn.git"
|
||||
},
|
||||
"keywords": [
|
||||
"Object",
|
||||
"hasOwn",
|
||||
"polyfill",
|
||||
"shim",
|
||||
"es-shim API"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/es-shims/Object.hasOwn/issues"
|
||||
},
|
||||
"homepage": "https://github.com/es-shims/Object.hasOwn",
|
||||
"dependencies": {
|
||||
"define-properties": "^1.1.4",
|
||||
"es-abstract": "^1.20.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@es-shims/api": "^2.2.3",
|
||||
"@ljharb/eslint-config": "^21.0.0",
|
||||
"aud": "^2.0.1",
|
||||
"auto-changelog": "^2.4.0",
|
||||
"call-bind": "^1.0.2",
|
||||
"eslint": "=8.8.0",
|
||||
"functions-have-names": "^1.2.3",
|
||||
"has-strict-mode": "^1.0.1",
|
||||
"has-symbols": "^1.0.3",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.0",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.6.1"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
7
kitabcitab/node_modules/object.hasown/polyfill.js
generated
vendored
Normal file
7
kitabcitab/node_modules/object.hasown/polyfill.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
var implementation = require('./implementation');
|
||||
|
||||
module.exports = function getPolyfill() {
|
||||
return Object.hasOwn || implementation;
|
||||
};
|
||||
14
kitabcitab/node_modules/object.hasown/shim.js
generated
vendored
Normal file
14
kitabcitab/node_modules/object.hasown/shim.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
'use strict';
|
||||
|
||||
var getPolyfill = require('./polyfill');
|
||||
var define = require('define-properties');
|
||||
|
||||
module.exports = function shimObjectHasOwn() {
|
||||
var polyfill = getPolyfill();
|
||||
define(
|
||||
Object,
|
||||
{ hasOwn: polyfill },
|
||||
{ hasOwn: function () { return Object.hasOwn !== polyfill; } }
|
||||
);
|
||||
return polyfill;
|
||||
};
|
||||
20
kitabcitab/node_modules/object.hasown/test/implementation.js
generated
vendored
Normal file
20
kitabcitab/node_modules/object.hasown/test/implementation.js
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
'use strict';
|
||||
|
||||
var hasOwn = 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 () { hasOwn.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { hasOwn.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(hasOwn, Object), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
11
kitabcitab/node_modules/object.hasown/test/index.js
generated
vendored
Normal file
11
kitabcitab/node_modules/object.hasown/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
'use strict';
|
||||
|
||||
var index = require('../');
|
||||
var test = require('tape');
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('as a function', function (t) {
|
||||
runTests(index, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
24
kitabcitab/node_modules/object.hasown/test/index.mjs
generated
vendored
Normal file
24
kitabcitab/node_modules/object.hasown/test/index.mjs
generated
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
import index, * as Module from 'object.hasown';
|
||||
import test from 'tape';
|
||||
import runTests from './tests.js';
|
||||
|
||||
test('as a function', (t) => {
|
||||
runTests(index, t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
test('named exports', async (t) => {
|
||||
t.deepEqual(
|
||||
Object.keys(Module).sort(),
|
||||
['default', 'shim', 'getPolyfill', 'implementation'].sort(),
|
||||
'has expected named exports',
|
||||
);
|
||||
|
||||
const { shim, getPolyfill, implementation } = Module;
|
||||
t.equal((await import('object.hasown/shim')).default, shim, 'shim named export matches deep export');
|
||||
t.equal((await import('object.hasown/implementation')).default, implementation, 'implementation named export matches deep export');
|
||||
t.equal((await import('object.hasown/polyfill')).default, getPolyfill, 'getPolyfill named export matches deep export');
|
||||
|
||||
t.end();
|
||||
});
|
||||
36
kitabcitab/node_modules/object.hasown/test/shimmed.js
generated
vendored
Normal file
36
kitabcitab/node_modules/object.hasown/test/shimmed.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
require('../auto');
|
||||
|
||||
var test = require('tape');
|
||||
var defineProperties = require('define-properties');
|
||||
var callBind = require('call-bind');
|
||||
|
||||
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
||||
var functionsHaveNames = require('functions-have-names')();
|
||||
var hasStrictMode = require('has-strict-mode')();
|
||||
|
||||
var runTests = require('./tests');
|
||||
|
||||
test('shimmed', function (t) {
|
||||
t.equal(Object.hasOwn.length, 2, 'Relect.hasOwn has a length of 2');
|
||||
t.test('Function name', { skip: !functionsHaveNames }, function (st) {
|
||||
st.equal(Object.hasOwn.name, 'hasOwn', 'Object.hasOwn has name "hasOwn"');
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('enumerability', { skip: !defineProperties.supportsDescriptors }, function (et) {
|
||||
et.equal(false, isEnumerable.call(Object, 'hasOwn'), 'Object.hasOwn is not enumerable');
|
||||
et.end();
|
||||
});
|
||||
|
||||
t.test('bad array/this value', { skip: !hasStrictMode }, function (st) {
|
||||
st['throws'](function () { return Object.hasOwn.call(undefined); }, TypeError, 'undefined is not an object');
|
||||
st['throws'](function () { return Object.hasOwn.call(null); }, TypeError, 'null is not an object');
|
||||
st.end();
|
||||
});
|
||||
|
||||
runTests(callBind(Object.hasOwn, Object), t);
|
||||
|
||||
t.end();
|
||||
});
|
||||
36
kitabcitab/node_modules/object.hasown/test/tests.js
generated
vendored
Normal file
36
kitabcitab/node_modules/object.hasown/test/tests.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
'use strict';
|
||||
|
||||
var hasSymbols = require('has-symbols')();
|
||||
|
||||
module.exports = function runTests(hasOwn, t) {
|
||||
var badPropertyKey = { toString: function () { throw new SyntaxError('nope'); } };
|
||||
|
||||
t['throws'](
|
||||
function () { hasOwn(null, badPropertyKey); },
|
||||
TypeError,
|
||||
'checks ToObject first'
|
||||
);
|
||||
|
||||
t['throws'](
|
||||
function () { hasOwn({}, badPropertyKey); },
|
||||
SyntaxError,
|
||||
'checks ToPropertyKey next'
|
||||
);
|
||||
|
||||
var obj = { a: 1 };
|
||||
t.equal('toString' in obj, true, 'object literal has non-own toString');
|
||||
t.equal(hasOwn(obj, 'toString'), false, 'toString is not an own property');
|
||||
t.equal(hasOwn(obj, 'a'), true, 'own property is recognized');
|
||||
|
||||
t.equal(hasOwn([], 'length'), true, 'non-enumerable own property is recognized');
|
||||
|
||||
t.test('Symbols', { skip: !hasSymbols }, function (st) {
|
||||
var o = {};
|
||||
o[Symbol.iterator] = true;
|
||||
st.equal(hasOwn(o, Symbol.iterator), true, 'own symbol is recognized');
|
||||
|
||||
st.equal(hasOwn(Array.prototype, Symbol.iterator), true, 'built-in own symbol is recognized');
|
||||
|
||||
st.end();
|
||||
});
|
||||
};
|
||||
Reference in New Issue
Block a user