cdk-lambda-subminute 2.0.550 → 2.0.551
Sign up to get free protection for your applications and to get access to all the features.
- package/.jsii +2 -2
- package/lib/cdk-lambda-subminute.js +3 -3
- package/node_modules/call-bind/CHANGELOG.md +13 -0
- package/node_modules/call-bind/index.js +6 -17
- package/node_modules/call-bind/package.json +14 -16
- package/node_modules/call-bind/test/index.js +4 -10
- package/node_modules/call-bind-apply-helpers/.eslintrc +16 -0
- package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +15 -0
- package/node_modules/{has-proto → call-bind-apply-helpers}/LICENSE +1 -1
- package/node_modules/call-bind-apply-helpers/README.md +62 -0
- package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
- package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
- package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
- package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
- package/node_modules/call-bind-apply-helpers/index.d.ts +46 -0
- package/node_modules/call-bind-apply-helpers/index.js +15 -0
- package/node_modules/call-bind-apply-helpers/package.json +85 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +1 -0
- package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
- package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
- package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
- package/node_modules/{has-proto → dunder-proto}/.github/FUNDING.yml +1 -1
- package/node_modules/dunder-proto/.nycrc +13 -0
- package/node_modules/dunder-proto/CHANGELOG.md +15 -0
- package/node_modules/dunder-proto/LICENSE +21 -0
- package/node_modules/dunder-proto/README.md +54 -0
- package/node_modules/dunder-proto/get.d.ts +5 -0
- package/node_modules/dunder-proto/get.js +23 -0
- package/node_modules/{has-proto → dunder-proto}/package.json +25 -41
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +29 -0
- package/node_modules/dunder-proto/test/get.js +34 -0
- package/node_modules/dunder-proto/test/index.js +4 -0
- package/node_modules/dunder-proto/test/set.js +41 -0
- package/node_modules/{has-proto → dunder-proto}/tsconfig.json +3 -5
- package/node_modules/es-define-property/CHANGELOG.md +14 -0
- package/node_modules/es-define-property/index.js +1 -3
- package/node_modules/es-define-property/package.json +12 -12
- package/node_modules/es-define-property/test/index.js +1 -0
- package/node_modules/es-define-property/tsconfig.json +2 -42
- package/node_modules/get-intrinsic/CHANGELOG.md +18 -0
- package/node_modules/get-intrinsic/index.js +20 -20
- package/node_modules/get-intrinsic/package.json +21 -19
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +2 -2
- package/package.json +1 -1
- package/node_modules/has-proto/CHANGELOG.md +0 -52
- package/node_modules/has-proto/README.md +0 -57
- package/node_modules/has-proto/accessor.d.ts +0 -3
- package/node_modules/has-proto/accessor.js +0 -20
- package/node_modules/has-proto/helpers/getDunder.js +0 -12
- package/node_modules/has-proto/helpers/setDunder.js +0 -9
- package/node_modules/has-proto/index.d.ts +0 -3
- package/node_modules/has-proto/index.js +0 -15
- package/node_modules/has-proto/mutator.d.ts +0 -3
- package/node_modules/has-proto/mutator.js +0 -33
- package/node_modules/has-proto/test/accessor.js +0 -34
- package/node_modules/has-proto/test/index.js +0 -28
- package/node_modules/has-proto/test/mutator.js +0 -34
- /package/node_modules/{has-proto → dunder-proto}/.eslintrc +0 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var callBind = require('../');
|
4
|
+
var hasStrictMode = require('has-strict-mode')();
|
5
|
+
var forEach = require('for-each');
|
6
|
+
var inspect = require('object-inspect');
|
7
|
+
var v = require('es-value-fixtures');
|
8
|
+
|
9
|
+
var test = require('tape');
|
10
|
+
|
11
|
+
test('callBindBasic', function (t) {
|
12
|
+
forEach(v.nonFunctions, function (nonFunction) {
|
13
|
+
t['throws'](
|
14
|
+
// @ts-expect-error
|
15
|
+
function () { callBind([nonFunction]); },
|
16
|
+
TypeError,
|
17
|
+
inspect(nonFunction) + ' is not a function'
|
18
|
+
);
|
19
|
+
});
|
20
|
+
|
21
|
+
var sentinel = { sentinel: true };
|
22
|
+
/** @type {<T>(this: T, a: number, b: number) => [T | undefined, number, number]} */
|
23
|
+
var func = function (a, b) {
|
24
|
+
// eslint-disable-next-line no-invalid-this
|
25
|
+
return [!hasStrictMode && this === global ? undefined : this, a, b];
|
26
|
+
};
|
27
|
+
t.equal(func.length, 2, 'original function length is 2');
|
28
|
+
|
29
|
+
/** type {(thisArg: unknown, a: number, b: number) => [unknown, number, number]} */
|
30
|
+
var bound = callBind([func]);
|
31
|
+
/** type {((a: number, b: number) => [sentinel, typeof a, typeof b])} */
|
32
|
+
var boundR = callBind([func, sentinel]);
|
33
|
+
/** type {((b: number) => [sentinel, number, typeof b])} */
|
34
|
+
var boundArg = callBind([func, sentinel, 1]);
|
35
|
+
|
36
|
+
// @ts-expect-error
|
37
|
+
t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with no args');
|
38
|
+
|
39
|
+
// @ts-expect-error
|
40
|
+
t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
|
41
|
+
// @ts-expect-error
|
42
|
+
t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func too few args');
|
43
|
+
// @ts-expect-error
|
44
|
+
t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args');
|
45
|
+
// @ts-expect-error
|
46
|
+
t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args');
|
47
|
+
|
48
|
+
t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args');
|
49
|
+
t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with right args');
|
50
|
+
t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args');
|
51
|
+
t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
|
52
|
+
|
53
|
+
// @ts-expect-error
|
54
|
+
t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args');
|
55
|
+
// @ts-expect-error
|
56
|
+
t.deepEqual(bound(1, 2, 3, 4), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args');
|
57
|
+
// @ts-expect-error
|
58
|
+
t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args');
|
59
|
+
// @ts-expect-error
|
60
|
+
t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args');
|
61
|
+
|
62
|
+
t.end();
|
63
|
+
});
|
@@ -4,7 +4,7 @@ github: [ljharb]
|
|
4
4
|
patreon: # Replace with a single Patreon username
|
5
5
|
open_collective: # Replace with a single Open Collective username
|
6
6
|
ko_fi: # Replace with a single Ko-fi username
|
7
|
-
tidelift: npm/
|
7
|
+
tidelift: npm/dunder-proto
|
8
8
|
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
9
|
liberapay: # Replace with a single Liberapay username
|
10
10
|
issuehunt: # Replace with a single IssueHunt username
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## v1.0.0 - 2024-12-06
|
9
|
+
|
10
|
+
### Commits
|
11
|
+
|
12
|
+
- Initial implementation, tests, readme, types [`a5b74b0`](https://github.com/es-shims/dunder-proto/commit/a5b74b0082f5270cb0905cd9a2e533cee7498373)
|
13
|
+
- Initial commit [`73fb5a3`](https://github.com/es-shims/dunder-proto/commit/73fb5a353b51ac2ab00c9fdeb0114daffd4c07a8)
|
14
|
+
- npm init [`80152dc`](https://github.com/es-shims/dunder-proto/commit/80152dc98155da4eb046d9f67a87ed96e8280a1d)
|
15
|
+
- Only apps should have lockfiles [`03e6660`](https://github.com/es-shims/dunder-proto/commit/03e6660a1d70dc401f3e217a031475ec537243dd)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2024 ECMAScript Shims
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# dunder-proto <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
2
|
+
|
3
|
+
[![github actions][actions-image]][actions-url]
|
4
|
+
[![coverage][codecov-image]][codecov-url]
|
5
|
+
[![License][license-image]][license-url]
|
6
|
+
[![Downloads][downloads-image]][downloads-url]
|
7
|
+
|
8
|
+
[![npm badge][npm-badge-png]][package-url]
|
9
|
+
|
10
|
+
If available, the `Object.prototype.__proto__` accessor and mutator, call-bound.
|
11
|
+
|
12
|
+
## Getting started
|
13
|
+
|
14
|
+
```sh
|
15
|
+
npm install --save dunder-proto
|
16
|
+
```
|
17
|
+
|
18
|
+
## Usage/Examples
|
19
|
+
|
20
|
+
```js
|
21
|
+
const assert = require('assert');
|
22
|
+
const getDunder = require('dunder-proto/get');
|
23
|
+
const setDunder = require('dunder-proto/set');
|
24
|
+
|
25
|
+
const obj = {};
|
26
|
+
|
27
|
+
assert.equal('toString' in obj, true);
|
28
|
+
assert.equal(getDunder(obj), Object.prototype);
|
29
|
+
|
30
|
+
setDunder(obj, null);
|
31
|
+
|
32
|
+
assert.equal('toString' in obj, false);
|
33
|
+
assert.equal(getDunder(obj), null);
|
34
|
+
```
|
35
|
+
|
36
|
+
## Tests
|
37
|
+
|
38
|
+
Clone the repo, `npm install`, and run `npm test`
|
39
|
+
|
40
|
+
[package-url]: https://npmjs.org/package/dunder-proto
|
41
|
+
[npm-version-svg]: https://versionbadg.es/es-shims/dunder-proto.svg
|
42
|
+
[deps-svg]: https://david-dm.org/es-shims/dunder-proto.svg
|
43
|
+
[deps-url]: https://david-dm.org/es-shims/dunder-proto
|
44
|
+
[dev-deps-svg]: https://david-dm.org/es-shims/dunder-proto/dev-status.svg
|
45
|
+
[dev-deps-url]: https://david-dm.org/es-shims/dunder-proto#info=devDependencies
|
46
|
+
[npm-badge-png]: https://nodei.co/npm/dunder-proto.png?downloads=true&stars=true
|
47
|
+
[license-image]: https://img.shields.io/npm/l/dunder-proto.svg
|
48
|
+
[license-url]: LICENSE
|
49
|
+
[downloads-image]: https://img.shields.io/npm/dm/dunder-proto.svg
|
50
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=dunder-proto
|
51
|
+
[codecov-image]: https://codecov.io/gh/es-shims/dunder-proto/branch/main/graphs/badge.svg
|
52
|
+
[codecov-url]: https://app.codecov.io/gh/es-shims/dunder-proto/
|
53
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/dunder-proto
|
54
|
+
[actions-url]: https://github.com/es-shims/dunder-proto/actions
|
@@ -0,0 +1,23 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var callBind = require('call-bind-apply-helpers');
|
4
|
+
var gOPD = require('gopd');
|
5
|
+
|
6
|
+
// eslint-disable-next-line no-extra-parens, no-proto
|
7
|
+
var hasProtoAccessor = /** @type {{ __proto__?: typeof Array.prototype }} */ ([]).__proto__ === Array.prototype;
|
8
|
+
|
9
|
+
// eslint-disable-next-line no-extra-parens
|
10
|
+
var desc = hasProtoAccessor && gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
11
|
+
|
12
|
+
var $Object = Object;
|
13
|
+
var $getPrototypeOf = $Object.getPrototypeOf;
|
14
|
+
|
15
|
+
/** @type {import('./get')} */
|
16
|
+
module.exports = desc && typeof desc.get === 'function'
|
17
|
+
? callBind([desc.get])
|
18
|
+
: typeof $getPrototypeOf === 'function'
|
19
|
+
? /** @type {import('./get')} */ function getDunder(value) {
|
20
|
+
// eslint-disable-next-line eqeqeq
|
21
|
+
return $getPrototypeOf(value == null ? value : $Object(value));
|
22
|
+
}
|
23
|
+
: false;
|
@@ -1,77 +1,59 @@
|
|
1
1
|
{
|
2
|
-
"name": "
|
3
|
-
"version": "1.
|
4
|
-
"description": "
|
5
|
-
"main":
|
2
|
+
"name": "dunder-proto",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "If available, the `Object.prototype.__proto__` accessor and mutator, call-bound",
|
5
|
+
"main": false,
|
6
6
|
"exports": {
|
7
|
-
"
|
8
|
-
"./
|
9
|
-
"./mutator": "./mutator.js",
|
7
|
+
"./get": "./get.js",
|
8
|
+
"./set": "./set.js",
|
10
9
|
"./package.json": "./package.json"
|
11
10
|
},
|
12
11
|
"sideEffects": false,
|
13
12
|
"scripts": {
|
14
13
|
"prepack": "npmignore --auto --commentLines=autogenerated",
|
15
|
-
"prepublishOnly": "safe-publish-latest",
|
16
14
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
15
|
+
"prepublishOnly": "safe-publish-latest",
|
17
16
|
"prelint": "evalmd README.md",
|
18
|
-
"lint": "eslint --ext
|
17
|
+
"lint": "eslint --ext=.js,.mjs .",
|
19
18
|
"postlint": "tsc -p . && attw -P",
|
20
19
|
"pretest": "npm run lint",
|
21
|
-
"tests-only": "tape 'test/**/*.js'",
|
20
|
+
"tests-only": "nyc tape 'test/**/*.js'",
|
22
21
|
"test": "npm run tests-only",
|
23
|
-
"posttest": "npx npm@'>=10.2' audit --production",
|
22
|
+
"posttest": "npx npm@'>= 10.2' audit --production",
|
24
23
|
"version": "auto-changelog && git add CHANGELOG.md",
|
25
24
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
26
25
|
},
|
27
26
|
"repository": {
|
28
27
|
"type": "git",
|
29
|
-
"url": "git+https://github.com/
|
28
|
+
"url": "git+https://github.com/es-shims/dunder-proto.git"
|
30
29
|
},
|
31
|
-
"keywords": [
|
32
|
-
"prototype",
|
33
|
-
"proto",
|
34
|
-
"set",
|
35
|
-
"get",
|
36
|
-
"__proto__",
|
37
|
-
"getPrototypeOf",
|
38
|
-
"setPrototypeOf",
|
39
|
-
"has"
|
40
|
-
],
|
41
30
|
"author": "Jordan Harband <ljharb@gmail.com>",
|
42
|
-
"funding": {
|
43
|
-
"url": "https://github.com/sponsors/ljharb"
|
44
|
-
},
|
45
31
|
"license": "MIT",
|
46
32
|
"bugs": {
|
47
|
-
"url": "https://github.com/
|
33
|
+
"url": "https://github.com/es-shims/dunder-proto/issues"
|
48
34
|
},
|
49
|
-
"homepage": "https://github.com/
|
50
|
-
"
|
51
|
-
"
|
35
|
+
"homepage": "https://github.com/es-shims/dunder-proto#readme",
|
36
|
+
"dependencies": {
|
37
|
+
"call-bind-apply-helpers": "^1.0.0",
|
38
|
+
"es-errors": "^1.3.0",
|
39
|
+
"gopd": "^1.2.0"
|
52
40
|
},
|
53
41
|
"devDependencies": {
|
54
42
|
"@arethetypeswrong/cli": "^0.17.0",
|
55
43
|
"@ljharb/eslint-config": "^21.1.1",
|
56
|
-
"@ljharb/tsconfig": "^0.2.
|
57
|
-
"@types/call-bind": "^1.0.5",
|
58
|
-
"@types/gopd": "^1.0.3",
|
44
|
+
"@ljharb/tsconfig": "^0.2.2",
|
59
45
|
"@types/tape": "^5.6.5",
|
60
46
|
"auto-changelog": "^2.5.0",
|
61
47
|
"encoding": "^0.1.13",
|
62
48
|
"eslint": "=8.8.0",
|
63
49
|
"evalmd": "^0.0.19",
|
64
|
-
"gopd": "^1.1.0",
|
65
50
|
"in-publish": "^2.0.1",
|
66
51
|
"npmignore": "^0.3.1",
|
67
|
-
"
|
52
|
+
"nyc": "^10.3.2",
|
68
53
|
"safe-publish-latest": "^2.0.0",
|
69
54
|
"tape": "^5.9.0",
|
70
55
|
"typescript": "next"
|
71
56
|
},
|
72
|
-
"engines": {
|
73
|
-
"node": ">= 0.4"
|
74
|
-
},
|
75
57
|
"auto-changelog": {
|
76
58
|
"output": "CHANGELOG.md",
|
77
59
|
"template": "keepachangelog",
|
@@ -80,13 +62,15 @@
|
|
80
62
|
"backfillLimit": false,
|
81
63
|
"hideCredit": true
|
82
64
|
},
|
65
|
+
"testling": {
|
66
|
+
"files": "test/index.js"
|
67
|
+
},
|
83
68
|
"publishConfig": {
|
84
69
|
"ignore": [
|
85
|
-
".github/workflows"
|
86
|
-
"types"
|
70
|
+
".github/workflows"
|
87
71
|
]
|
88
72
|
},
|
89
|
-
"
|
90
|
-
"
|
73
|
+
"engines": {
|
74
|
+
"node": ">= 0.4"
|
91
75
|
}
|
92
76
|
}
|
@@ -0,0 +1,29 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var callBind = require('call-bind-apply-helpers');
|
4
|
+
var gOPD = require('gopd');
|
5
|
+
var $TypeError = require('es-errors/type');
|
6
|
+
|
7
|
+
/** @type {{ __proto__?: object | null }} */
|
8
|
+
var obj = {};
|
9
|
+
obj.__proto__ = null; // eslint-disable-line no-proto
|
10
|
+
|
11
|
+
var hasProtoMutator = !('toString' in obj);
|
12
|
+
|
13
|
+
// eslint-disable-next-line no-extra-parens
|
14
|
+
var desc = gOPD && gOPD(Object.prototype, /** @type {keyof typeof Object.prototype} */ ('__proto__'));
|
15
|
+
|
16
|
+
/** @type {import('./set')} */
|
17
|
+
module.exports = hasProtoMutator && (
|
18
|
+
// eslint-disable-next-line no-extra-parens
|
19
|
+
(!!desc && typeof desc.set === 'function' && /** @type {import('./set')} */ (callBind([desc.set])))
|
20
|
+
|| /** @type {import('./set')} */ function setDunder(object, proto) {
|
21
|
+
// this is node v0.10 or older, which doesn't have Object.setPrototypeOf and has undeniable __proto__
|
22
|
+
if (object == null) { // eslint-disable-line eqeqeq
|
23
|
+
throw new $TypeError('set Object.prototype.__proto__ called on null or undefined');
|
24
|
+
}
|
25
|
+
// eslint-disable-next-line no-proto, no-param-reassign, no-extra-parens
|
26
|
+
/** @type {{ __proto__?: object | null }} */ (object).__proto__ = proto;
|
27
|
+
return proto;
|
28
|
+
}
|
29
|
+
);
|
@@ -0,0 +1,34 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var test = require('tape');
|
4
|
+
|
5
|
+
var getDunderProto = require('../get');
|
6
|
+
|
7
|
+
test('getDunderProto', { skip: !getDunderProto }, function (t) {
|
8
|
+
if (!getDunderProto) {
|
9
|
+
throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
|
10
|
+
}
|
11
|
+
|
12
|
+
// @ts-expect-error
|
13
|
+
t['throws'](function () { getDunderProto(); }, TypeError, 'throws if no argument');
|
14
|
+
// @ts-expect-error
|
15
|
+
t['throws'](function () { getDunderProto(undefined); }, TypeError, 'throws with undefined');
|
16
|
+
// @ts-expect-error
|
17
|
+
t['throws'](function () { getDunderProto(null); }, TypeError, 'throws with null');
|
18
|
+
|
19
|
+
t.equal(getDunderProto({}), Object.prototype);
|
20
|
+
t.equal(getDunderProto([]), Array.prototype);
|
21
|
+
t.equal(getDunderProto(function () {}), Function.prototype);
|
22
|
+
t.equal(getDunderProto(/./g), RegExp.prototype);
|
23
|
+
t.equal(getDunderProto(42), Number.prototype);
|
24
|
+
t.equal(getDunderProto(true), Boolean.prototype);
|
25
|
+
t.equal(getDunderProto('foo'), String.prototype);
|
26
|
+
|
27
|
+
t.end();
|
28
|
+
});
|
29
|
+
|
30
|
+
test('no dunder proto', { skip: !!getDunderProto }, function (t) {
|
31
|
+
t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
|
32
|
+
|
33
|
+
t.end();
|
34
|
+
});
|
@@ -0,0 +1,41 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var test = require('tape');
|
4
|
+
|
5
|
+
var setDunderProto = require('../set');
|
6
|
+
|
7
|
+
test('setDunderProto', { skip: !setDunderProto }, function (t) {
|
8
|
+
if (!setDunderProto) {
|
9
|
+
throw 'should never happen; this is just for type narrowing'; // eslint-disable-line no-throw-literal
|
10
|
+
}
|
11
|
+
|
12
|
+
// @ts-expect-error
|
13
|
+
t['throws'](function () { setDunderProto(); }, TypeError, 'throws if no arguments');
|
14
|
+
// @ts-expect-error
|
15
|
+
t['throws'](function () { setDunderProto(undefined); }, TypeError, 'throws with undefined and nothing');
|
16
|
+
// @ts-expect-error
|
17
|
+
t['throws'](function () { setDunderProto(undefined, undefined); }, TypeError, 'throws with undefined and undefined');
|
18
|
+
// @ts-expect-error
|
19
|
+
t['throws'](function () { setDunderProto(null); }, TypeError, 'throws with null and undefined');
|
20
|
+
// @ts-expect-error
|
21
|
+
t['throws'](function () { setDunderProto(null, undefined); }, TypeError, 'throws with null and undefined');
|
22
|
+
|
23
|
+
/** @type {{ inherited?: boolean }} */
|
24
|
+
var obj = {};
|
25
|
+
t.ok('toString' in obj, 'object initially has toString');
|
26
|
+
|
27
|
+
setDunderProto(obj, null);
|
28
|
+
t.notOk('toString' in obj, 'object no longer has toString');
|
29
|
+
|
30
|
+
t.notOk('inherited' in obj, 'object lacks inherited property');
|
31
|
+
setDunderProto(obj, { inherited: true });
|
32
|
+
t.equal(obj.inherited, true, 'object has inherited property');
|
33
|
+
|
34
|
+
t.end();
|
35
|
+
});
|
36
|
+
|
37
|
+
test('no dunder proto', { skip: !!setDunderProto }, function (t) {
|
38
|
+
t.notOk('__proto__' in Object.prototype, 'no __proto__ in Object.prototype');
|
39
|
+
|
40
|
+
t.end();
|
41
|
+
});
|
@@ -5,6 +5,20 @@ All notable changes to this project will be documented in this file.
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
7
|
|
8
|
+
## [v1.0.1](https://github.com/ljharb/es-define-property/compare/v1.0.0...v1.0.1) - 2024-12-06
|
9
|
+
|
10
|
+
### Commits
|
11
|
+
|
12
|
+
- [types] use shared tsconfig [`954a663`](https://github.com/ljharb/es-define-property/commit/954a66360326e508a0e5daa4b07493d58f5e110e)
|
13
|
+
- [actions] split out node 10-20, and 20+ [`3a8e84b`](https://github.com/ljharb/es-define-property/commit/3a8e84b23883f26ff37b3e82ff283834228e18c6)
|
14
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/tape`, `auto-changelog`, `gopd`, `tape` [`86ae27b`](https://github.com/ljharb/es-define-property/commit/86ae27bb8cc857b23885136fad9cbe965ae36612)
|
15
|
+
- [Refactor] avoid using `get-intrinsic` [`02480c0`](https://github.com/ljharb/es-define-property/commit/02480c0353ef6118965282977c3864aff53d98b1)
|
16
|
+
- [Tests] replace `aud` with `npm audit` [`f6093ff`](https://github.com/ljharb/es-define-property/commit/f6093ff74ab51c98015c2592cd393bd42478e773)
|
17
|
+
- [Tests] configure testling [`7139e66`](https://github.com/ljharb/es-define-property/commit/7139e66959247a56086d9977359caef27c6849e7)
|
18
|
+
- [Dev Deps] update `tape` [`b901b51`](https://github.com/ljharb/es-define-property/commit/b901b511a75e001a40ce1a59fef7d9ffcfc87482)
|
19
|
+
- [Tests] fix types in tests [`469d269`](https://github.com/ljharb/es-define-property/commit/469d269fd141b1e773ec053a9fa35843493583e0)
|
20
|
+
- [Dev Deps] add missing peer dep [`733acfb`](https://github.com/ljharb/es-define-property/commit/733acfb0c4c96edf337e470b89a25a5b3724c352)
|
21
|
+
|
8
22
|
## v1.0.0 - 2024-02-12
|
9
23
|
|
10
24
|
### Commits
|
@@ -1,9 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
var GetIntrinsic = require('get-intrinsic');
|
4
|
-
|
5
3
|
/** @type {import('.')} */
|
6
|
-
var $defineProperty =
|
4
|
+
var $defineProperty = Object.defineProperty || false;
|
7
5
|
if ($defineProperty) {
|
8
6
|
try {
|
9
7
|
$defineProperty({}, 'a', { value: 1 });
|
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "es-define-property",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.1",
|
4
4
|
"description": "`Object.defineProperty`, but not IE 8's broken one.",
|
5
5
|
"main": "index.js",
|
6
6
|
"types": "./index.d.ts",
|
@@ -19,7 +19,7 @@
|
|
19
19
|
"pretest": "npm run lint",
|
20
20
|
"tests-only": "nyc tape 'test/**/*.js'",
|
21
21
|
"test": "npm run tests-only",
|
22
|
-
"posttest": "
|
22
|
+
"posttest": "npx npm@'>= 10.2' audit --production",
|
23
23
|
"version": "auto-changelog && git add CHANGELOG.md",
|
24
24
|
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
25
25
|
},
|
@@ -42,29 +42,29 @@
|
|
42
42
|
"url": "https://github.com/ljharb/es-define-property/issues"
|
43
43
|
},
|
44
44
|
"homepage": "https://github.com/ljharb/es-define-property#readme",
|
45
|
-
"dependencies": {
|
46
|
-
"get-intrinsic": "^1.2.4"
|
47
|
-
},
|
48
45
|
"devDependencies": {
|
49
|
-
"@ljharb/eslint-config": "^21.1.
|
50
|
-
"@
|
46
|
+
"@ljharb/eslint-config": "^21.1.1",
|
47
|
+
"@ljharb/tsconfig": "^0.2.2",
|
51
48
|
"@types/gopd": "^1.0.3",
|
52
|
-
"@types/tape": "^5.6.
|
53
|
-
"
|
54
|
-
"
|
49
|
+
"@types/tape": "^5.6.5",
|
50
|
+
"auto-changelog": "^2.5.0",
|
51
|
+
"encoding": "^0.1.13",
|
55
52
|
"eslint": "^8.8.0",
|
56
53
|
"evalmd": "^0.0.19",
|
57
|
-
"gopd": "^1.0
|
54
|
+
"gopd": "^1.2.0",
|
58
55
|
"in-publish": "^2.0.1",
|
59
56
|
"npmignore": "^0.3.1",
|
60
57
|
"nyc": "^10.3.2",
|
61
58
|
"safe-publish-latest": "^2.0.0",
|
62
|
-
"tape": "^5.
|
59
|
+
"tape": "^5.9.0",
|
63
60
|
"typescript": "next"
|
64
61
|
},
|
65
62
|
"engines": {
|
66
63
|
"node": ">= 0.4"
|
67
64
|
},
|
65
|
+
"testling": {
|
66
|
+
"files": "test/index.js"
|
67
|
+
},
|
68
68
|
"auto-changelog": {
|
69
69
|
"output": "CHANGELOG.md",
|
70
70
|
"template": "keepachangelog",
|
@@ -10,6 +10,7 @@ test('defineProperty: supported', { skip: !$defineProperty }, function (t) {
|
|
10
10
|
|
11
11
|
t.equal(typeof $defineProperty, 'function', 'defineProperty is supported');
|
12
12
|
if ($defineProperty && gOPD) { // this `if` check is just to shut TS up
|
13
|
+
/** @type {{ a: number, b?: number, c?: number }} */
|
13
14
|
var o = { a: 1 };
|
14
15
|
|
15
16
|
$defineProperty(o, 'b', { enumerable: true, value: 2 });
|
@@ -1,47 +1,7 @@
|
|
1
1
|
{
|
2
|
+
"extends": "@ljharb/tsconfig",
|
2
3
|
"compilerOptions": {
|
3
|
-
|
4
|
-
|
5
|
-
/* Projects */
|
6
|
-
|
7
|
-
/* Language and Environment */
|
8
|
-
"target": "es2022", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
9
|
-
// "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
|
10
|
-
// "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
|
11
|
-
"useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
|
12
|
-
// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
|
13
|
-
|
14
|
-
/* Modules */
|
15
|
-
"module": "commonjs", /* Specify what module code is generated. */
|
16
|
-
// "rootDir": "./", /* Specify the root folder within your source files. */
|
17
|
-
// "moduleResolution": "node", /* Specify how TypeScript looks up a file from a given module specifier. */
|
18
|
-
// "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
|
19
|
-
// "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
|
20
|
-
// "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
|
21
|
-
// "typeRoots": ["types"], /* Specify multiple folders that act like `./node_modules/@types`. */
|
22
|
-
"resolveJsonModule": true, /* Enable importing .json files. */
|
23
|
-
// "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
|
24
|
-
|
25
|
-
/* JavaScript Support */
|
26
|
-
"allowJs": true, /* Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files. */
|
27
|
-
"checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
|
28
|
-
"maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with `allowJs`. */
|
29
|
-
|
30
|
-
/* Emit */
|
31
|
-
"declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
|
32
|
-
"declarationMap": true, /* Create sourcemaps for d.ts files. */
|
33
|
-
"noEmit": true, /* Disable emitting files from a compilation. */
|
34
|
-
|
35
|
-
/* Interop Constraints */
|
36
|
-
"allowSyntheticDefaultImports": true, /* Allow `import x from y` when a module doesn't have a default export. */
|
37
|
-
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
|
38
|
-
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
39
|
-
|
40
|
-
/* Type Checking */
|
41
|
-
"strict": true, /* Enable all strict type-checking options. */
|
42
|
-
|
43
|
-
/* Completeness */
|
44
|
-
// "skipLibCheck": true /* Skip type checking all .d.ts files. */
|
4
|
+
"target": "es2022",
|
45
5
|
},
|
46
6
|
"exclude": [
|
47
7
|
"coverage",
|