Initial Save
This commit is contained in:
16
node_modules/own-keys/.eslintrc
generated
vendored
Normal file
16
node_modules/own-keys/.eslintrc
generated
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"root": true,
|
||||
|
||||
"extends": "@ljharb",
|
||||
|
||||
"rules": {
|
||||
"func-style": "off",
|
||||
"id-length": "off",
|
||||
"max-lines-per-function": "off",
|
||||
"new-cap": ["error", {
|
||||
"capIsNewExceptions": [
|
||||
"GetIntrinsic",
|
||||
],
|
||||
}],
|
||||
},
|
||||
}
|
||||
12
node_modules/own-keys/.github/FUNDING.yml
generated
vendored
Normal file
12
node_modules/own-keys/.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/own-keys
|
||||
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
node_modules/own-keys/.nycrc
generated
vendored
Normal file
9
node_modules/own-keys/.nycrc
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"all": true,
|
||||
"check-coverage": false,
|
||||
"reporter": ["text-summary", "text", "html", "json"],
|
||||
"exclude": [
|
||||
"coverage",
|
||||
"test"
|
||||
]
|
||||
}
|
||||
23
node_modules/own-keys/CHANGELOG.md
generated
vendored
Normal file
23
node_modules/own-keys/CHANGELOG.md
generated
vendored
Normal file
@@ -0,0 +1,23 @@
|
||||
# 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.0.1](https://github.com/ljharb/own-keys/compare/v1.0.0...v1.0.1) - 2024-12-29
|
||||
|
||||
### Commits
|
||||
|
||||
- [Tests] sort with a proper comparator [`4a65b56`](https://github.com/ljharb/own-keys/commit/4a65b569d10985032a0773806dcdec8866132baa)
|
||||
- [Fix] fix function name when `Reflect.ownKeys` is absent [`5cf17cb`](https://github.com/ljharb/own-keys/commit/5cf17cb1c9adfa836a1ddc467da4da20973db2ae)
|
||||
|
||||
## v1.0.0 - 2024-12-28
|
||||
|
||||
### Commits
|
||||
|
||||
- Initial implementation, tests, readme, types [`870a06f`](https://github.com/ljharb/own-keys/commit/870a06f9d7a2a6ecee283319d9a7388f8fc1c811)
|
||||
- Initial commit [`70323dc`](https://github.com/ljharb/own-keys/commit/70323dc09541b4ee80426acfc89762605d7fc7bf)
|
||||
- npm init [`4a3ad06`](https://github.com/ljharb/own-keys/commit/4a3ad0659defe9a67541c198743bd7733d437725)
|
||||
- [Tests] node 0.8 sorts object keys differently [`b449364`](https://github.com/ljharb/own-keys/commit/b4493649ead7441fd8e65ab4718acbd088ceac70)
|
||||
- Only apps should have lockfiles [`a54acbf`](https://github.com/ljharb/own-keys/commit/a54acbf2c6b8ef320abf7493b7c88002c690f9c0)
|
||||
21
node_modules/own-keys/LICENSE
generated
vendored
Normal file
21
node_modules/own-keys/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2024 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.
|
||||
45
node_modules/own-keys/README.md
generated
vendored
Normal file
45
node_modules/own-keys/README.md
generated
vendored
Normal file
@@ -0,0 +1,45 @@
|
||||
# own-keys <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
||||
|
||||
[![github actions][actions-image]][actions-url]
|
||||
[![coverage][codecov-image]][codecov-url]
|
||||
[![License][license-image]][license-url]
|
||||
[![Downloads][downloads-image]][downloads-url]
|
||||
|
||||
[![npm badge][npm-badge-png]][package-url]
|
||||
|
||||
Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible.
|
||||
|
||||
## Getting started
|
||||
|
||||
```sh
|
||||
npm install --save own-keys
|
||||
```
|
||||
|
||||
## Usage/Examples
|
||||
|
||||
```js
|
||||
var ownKeys = require('own-keys');
|
||||
var assert = require('assert');
|
||||
|
||||
assert.deepEqual(ownKeys({ a: 1, b: 2 }), ['a', 'b']);
|
||||
assert.deepEqual(ownKeys([1, 2, 3]), [0, 1, 2, 'length']);
|
||||
```
|
||||
|
||||
## Tests
|
||||
Simply clone the repo, `npm install`, and run `npm test`
|
||||
|
||||
[package-url]: https://npmjs.org/package/own-keys
|
||||
[npm-version-svg]: https://versionbadg.es/ljharb/own-keys.svg
|
||||
[deps-svg]: https://david-dm.org/ljharb/own-keys.svg
|
||||
[deps-url]: https://david-dm.org/ljharb/own-keys
|
||||
[dev-deps-svg]: https://david-dm.org/ljharb/own-keys/dev-status.svg
|
||||
[dev-deps-url]: https://david-dm.org/ljharb/own-keys#info=devDependencies
|
||||
[npm-badge-png]: https://nodei.co/npm/own-keys.png?downloads=true&stars=true
|
||||
[license-image]: https://img.shields.io/npm/l/own-keys.svg
|
||||
[license-url]: LICENSE
|
||||
[downloads-image]: https://img.shields.io/npm/dm/own-keys.svg
|
||||
[downloads-url]: https://npm-stat.com/charts.html?package=own-keys
|
||||
[codecov-image]: https://codecov.io/gh/ljharb/own-keys/branch/main/graphs/badge.svg
|
||||
[codecov-url]: https://app.codecov.io/gh/ljharb/own-keys/
|
||||
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/own-keys
|
||||
[actions-url]: https://github.com/ljharb/own-keys/actions
|
||||
3
node_modules/own-keys/index.d.ts
generated
vendored
Normal file
3
node_modules/own-keys/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
declare function ownKeys<T extends Record<PropertyKey, V>, V>(object: T): (keyof T)[];
|
||||
|
||||
export = ownKeys;
|
||||
21
node_modules/own-keys/index.js
generated
vendored
Normal file
21
node_modules/own-keys/index.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
'use strict';
|
||||
|
||||
var GetIntrinsic = require('get-intrinsic');
|
||||
|
||||
var safePushApply = require('safe-push-apply');
|
||||
|
||||
var $ownKeys = GetIntrinsic('%Reflect.ownKeys%', true);
|
||||
var $gOPN = GetIntrinsic('%Object.getOwnPropertyNames%', true);
|
||||
var $gOPS = GetIntrinsic('%Object.getOwnPropertySymbols%', true);
|
||||
|
||||
var keys = require('object-keys');
|
||||
|
||||
/** @type {import('.')} */
|
||||
module.exports = $ownKeys || function ownKeys(source) {
|
||||
/** @type {(keyof typeof source)[]} */
|
||||
var sourceKeys = ($gOPN || keys)(source);
|
||||
if ($gOPS) {
|
||||
safePushApply(sourceKeys, $gOPS(source));
|
||||
}
|
||||
return sourceKeys;
|
||||
};
|
||||
91
node_modules/own-keys/package.json
generated
vendored
Normal file
91
node_modules/own-keys/package.json
generated
vendored
Normal file
@@ -0,0 +1,91 @@
|
||||
{
|
||||
"name": "own-keys",
|
||||
"version": "1.0.1",
|
||||
"description": "Robustly get an object's own property keys (strings and symbols), including non-enumerables when possible",
|
||||
"main": "index.js",
|
||||
"exports": {
|
||||
".": "./index.js",
|
||||
"./package.json": "./package.json"
|
||||
},
|
||||
"sideEffects": false,
|
||||
"scripts": {
|
||||
"prepack": "npmignore --auto --commentLines=autogenerated",
|
||||
"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)\")\"",
|
||||
"prelint": "evalmd README.md",
|
||||
"lint": "eslint --ext=js,mjs .",
|
||||
"postlint": "tsc && attw -P",
|
||||
"prepublish": "not-in-publish || npm run prepublishOnly",
|
||||
"prepublishOnly": "safe-publish-latest",
|
||||
"pretest": "npm run lint",
|
||||
"tests-only": "nyc tape test",
|
||||
"test": "npm run tests-only",
|
||||
"posttest": "npx npm@'>= 10.2' audit --production"
|
||||
},
|
||||
"keywords": [
|
||||
"own",
|
||||
"key",
|
||||
"keys",
|
||||
"propertykey",
|
||||
"string",
|
||||
"symbol",
|
||||
"enumerable",
|
||||
"non-enumerable",
|
||||
"robust"
|
||||
],
|
||||
"author": "Jordan Harband <ljharb@gmail.com>",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
},
|
||||
"license": "MIT",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/ljharb/own-keys.git"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/ljharb/own-keys/issues"
|
||||
},
|
||||
"homepage": "https://github.com/ljharb/own-keys#readme",
|
||||
"dependencies": {
|
||||
"get-intrinsic": "^1.2.6",
|
||||
"object-keys": "^1.1.1",
|
||||
"safe-push-apply": "^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@arethetypeswrong/cli": "^0.17.2",
|
||||
"@ljharb/eslint-config": "^21.1.1",
|
||||
"@ljharb/tsconfig": "^0.2.3",
|
||||
"@types/get-intrinsic": "^1.2.3",
|
||||
"@types/isarray": "^2.0.3",
|
||||
"@types/object-keys": "^1.0.3",
|
||||
"@types/tape": "^5.8.0",
|
||||
"auto-changelog": "^2.5.0",
|
||||
"encoding": "^0.1.13",
|
||||
"eslint": "=8.8.0",
|
||||
"evalmd": "^0.0.19",
|
||||
"has-property-descriptors": "^1.0.2",
|
||||
"has-symbols": "^1.1.0",
|
||||
"in-publish": "^2.0.1",
|
||||
"npmignore": "^0.3.1",
|
||||
"nyc": "^10.3.2",
|
||||
"safe-publish-latest": "^2.0.0",
|
||||
"tape": "^5.9.0",
|
||||
"typescript": "next"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"auto-changelog": {
|
||||
"output": "CHANGELOG.md",
|
||||
"template": "keepachangelog",
|
||||
"unreleased": false,
|
||||
"commitLimit": false,
|
||||
"backfillLimit": false,
|
||||
"hideCredit": true
|
||||
},
|
||||
"publishConfig": {
|
||||
"ignore": [
|
||||
".github/workflows"
|
||||
]
|
||||
}
|
||||
}
|
||||
72
node_modules/own-keys/test/index.js
generated
vendored
Normal file
72
node_modules/own-keys/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,72 @@
|
||||
'use strict';
|
||||
|
||||
var test = require('tape');
|
||||
var hasSymbols = require('has-symbols/shams')();
|
||||
var hasPropertyDescriptors = require('has-property-descriptors')();
|
||||
|
||||
var ownKeys = require('../');
|
||||
|
||||
/** @type {(a: PropertyKey, b: PropertyKey) => number} */
|
||||
function comparator(a, b) {
|
||||
if (typeof a === 'string' && typeof b === 'string') {
|
||||
return a.localeCompare(b);
|
||||
}
|
||||
if (typeof a === 'number' && typeof b === 'number') {
|
||||
return a - b;
|
||||
}
|
||||
return typeof a === 'symbol' ? 1 : -1;
|
||||
}
|
||||
|
||||
test('ownKeys', function (t) {
|
||||
t.equal(typeof ownKeys, 'function', 'is a function');
|
||||
t.equal(
|
||||
ownKeys.length,
|
||||
1,
|
||||
'has a length of 1'
|
||||
);
|
||||
|
||||
t.test('basics', function (st) {
|
||||
var obj = { a: 1, b: 2 };
|
||||
if (hasPropertyDescriptors) {
|
||||
Object.defineProperty(obj, 'c', {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: 3
|
||||
});
|
||||
}
|
||||
|
||||
st.deepEqual(
|
||||
ownKeys(obj).sort(comparator),
|
||||
(hasPropertyDescriptors ? ['a', 'b', 'c'] : ['a', 'b']).sort(comparator),
|
||||
'includes non-enumerable properties'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.test('symbols', { skip: !hasSymbols }, function (st) {
|
||||
/** @type {Record<PropertyKey, unknown>} */
|
||||
var obj = { a: 1 };
|
||||
var sym = Symbol('b');
|
||||
obj[sym] = 2;
|
||||
|
||||
var nonEnumSym = Symbol('c');
|
||||
Object.defineProperty(obj, nonEnumSym, {
|
||||
configurable: true,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
value: 3
|
||||
});
|
||||
|
||||
st.deepEqual(
|
||||
ownKeys(obj).sort(comparator),
|
||||
['a', sym, nonEnumSym].sort(comparator),
|
||||
'works with symbols, both enum and non-enum'
|
||||
);
|
||||
|
||||
st.end();
|
||||
});
|
||||
|
||||
t.end();
|
||||
});
|
||||
9
node_modules/own-keys/tsconfig.json
generated
vendored
Normal file
9
node_modules/own-keys/tsconfig.json
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"extends": "@ljharb/tsconfig",
|
||||
"compilerOptions": {
|
||||
"target": "es2021",
|
||||
},
|
||||
"exclude": [
|
||||
"coverage",
|
||||
],
|
||||
}
|
||||
Reference in New Issue
Block a user