cdk-lambda-subminute 2.0.272 → 2.0.274
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +3 -3
- package/lib/cdk-lambda-subminute.js +3 -3
- package/node_modules/aws-sdk/CHANGELOG.md +18 -1
- package/node_modules/aws-sdk/README.md +1 -1
- package/node_modules/aws-sdk/apis/appintegrations-2020-07-29.min.json +1 -2
- package/node_modules/aws-sdk/apis/connect-2017-08-08.min.json +28 -6
- package/node_modules/aws-sdk/apis/discovery-2015-11-01.min.json +167 -35
- package/node_modules/aws-sdk/apis/discovery-2015-11-01.paginators.json +34 -2
- package/node_modules/aws-sdk/apis/metadata.json +0 -3
- package/node_modules/aws-sdk/apis/omics-2022-11-28.min.json +30 -21
- package/node_modules/aws-sdk/apis/opensearch-2021-01-01.min.json +134 -9
- package/node_modules/aws-sdk/apis/opensearch-2021-01-01.paginators.json +5 -0
- package/node_modules/aws-sdk/apis/quicksight-2018-04-01.min.json +776 -698
- package/node_modules/aws-sdk/apis/ssm-2014-11-06.min.json +188 -173
- package/node_modules/aws-sdk/clients/all.d.ts +0 -1
- package/node_modules/aws-sdk/clients/all.js +0 -1
- package/node_modules/aws-sdk/clients/appintegrations.d.ts +1 -1
- package/node_modules/aws-sdk/clients/connect.d.ts +53 -31
- package/node_modules/aws-sdk/clients/discovery.d.ts +170 -0
- package/node_modules/aws-sdk/clients/ec2.d.ts +1 -1
- package/node_modules/aws-sdk/clients/managedblockchainquery.d.ts +1 -1
- package/node_modules/aws-sdk/clients/medicalimaging.d.ts +10 -10
- package/node_modules/aws-sdk/clients/neptunedata.d.ts +81 -81
- package/node_modules/aws-sdk/clients/omics.d.ts +27 -1
- package/node_modules/aws-sdk/clients/opensearch.d.ts +152 -1
- package/node_modules/aws-sdk/clients/quicksight.d.ts +111 -7
- package/node_modules/aws-sdk/clients/secretsmanager.d.ts +7 -7
- package/node_modules/aws-sdk/clients/servicecatalog.d.ts +9 -9
- package/node_modules/aws-sdk/clients/ssm.d.ts +19 -3
- package/node_modules/aws-sdk/clients/verifiedpermissions.d.ts +2 -2
- package/node_modules/aws-sdk/clients/workspaces.d.ts +2 -2
- package/node_modules/aws-sdk/dist/aws-sdk-core-react-native.js +246 -86
- package/node_modules/aws-sdk/dist/aws-sdk-react-native.js +1974 -1691
- package/node_modules/aws-sdk/dist/aws-sdk.js +219 -185
- package/node_modules/aws-sdk/dist/aws-sdk.min.js +78 -78
- package/node_modules/aws-sdk/lib/config_service_placeholders.d.ts +0 -2
- package/node_modules/aws-sdk/lib/core.js +1 -1
- package/node_modules/aws-sdk/package.json +1 -1
- package/node_modules/call-bind/.eslintrc +0 -1
- package/node_modules/call-bind/.nycrc +0 -4
- package/node_modules/call-bind/CHANGELOG.md +35 -0
- package/node_modules/call-bind/README.md +63 -1
- package/node_modules/call-bind/index.js +10 -13
- package/node_modules/call-bind/package.json +33 -23
- package/node_modules/call-bind/test/callBound.js +0 -1
- package/node_modules/call-bind/test/index.js +18 -4
- package/node_modules/define-data-property/.eslintrc +24 -0
- package/node_modules/define-data-property/.github/FUNDING.yml +12 -0
- package/node_modules/define-data-property/.nycrc +13 -0
- package/node_modules/define-data-property/CHANGELOG.md +41 -0
- package/node_modules/define-data-property/LICENSE +21 -0
- package/node_modules/define-data-property/README.md +67 -0
- package/node_modules/define-data-property/index.d.ts +3 -0
- package/node_modules/define-data-property/index.d.ts.map +1 -0
- package/node_modules/define-data-property/index.js +68 -0
- package/node_modules/define-data-property/package.json +113 -0
- package/node_modules/define-data-property/test/index.js +392 -0
- package/node_modules/define-data-property/tsconfig.json +59 -0
- package/node_modules/has-property-descriptors/.eslintrc +13 -0
- package/node_modules/has-property-descriptors/.github/FUNDING.yml +12 -0
- package/node_modules/has-property-descriptors/.nycrc +9 -0
- package/node_modules/has-property-descriptors/CHANGELOG.md +16 -0
- package/node_modules/has-property-descriptors/LICENSE +21 -0
- package/node_modules/has-property-descriptors/README.md +43 -0
- package/node_modules/has-property-descriptors/index.js +33 -0
- package/node_modules/has-property-descriptors/package.json +70 -0
- package/node_modules/has-property-descriptors/test/index.js +57 -0
- package/node_modules/set-function-length/.eslintrc +27 -0
- package/node_modules/set-function-length/.github/FUNDING.yml +12 -0
- package/node_modules/set-function-length/.nycrc +13 -0
- package/node_modules/set-function-length/CHANGELOG.md +41 -0
- package/node_modules/set-function-length/LICENSE +21 -0
- package/node_modules/set-function-length/README.md +56 -0
- package/node_modules/set-function-length/env.js +19 -0
- package/node_modules/set-function-length/index.js +41 -0
- package/node_modules/set-function-length/package.json +84 -0
- package/node_modules/which-typed-array/CHANGELOG.md +14 -0
- package/node_modules/which-typed-array/index.js +4 -1
- package/node_modules/which-typed-array/package.json +3 -3
- package/package.json +3 -3
- package/node_modules/aws-sdk/apis/gamesparks-2021-08-17.examples.json +0 -5
- package/node_modules/aws-sdk/apis/gamesparks-2021-08-17.min.json +0 -1376
- package/node_modules/aws-sdk/apis/gamesparks-2021-08-17.paginators.json +0 -46
- package/node_modules/aws-sdk/clients/gamesparks.d.ts +0 -1344
- package/node_modules/aws-sdk/clients/gamesparks.js +0 -18
@@ -302,7 +302,6 @@ export abstract class ConfigurationServicePlaceholders {
|
|
302
302
|
amplifyuibuilder?: AWS.AmplifyUIBuilder.Types.ClientConfiguration;
|
303
303
|
keyspaces?: AWS.Keyspaces.Types.ClientConfiguration;
|
304
304
|
billingconductor?: AWS.Billingconductor.Types.ClientConfiguration;
|
305
|
-
gamesparks?: AWS.GameSparks.Types.ClientConfiguration;
|
306
305
|
pinpointsmsvoicev2?: AWS.PinpointSMSVoiceV2.Types.ClientConfiguration;
|
307
306
|
ivschat?: AWS.Ivschat.Types.ClientConfiguration;
|
308
307
|
chimesdkmediapipelines?: AWS.ChimeSDKMediaPipelines.Types.ClientConfiguration;
|
@@ -663,7 +662,6 @@ export interface ConfigurationServiceApiVersions {
|
|
663
662
|
amplifyuibuilder?: AWS.AmplifyUIBuilder.Types.apiVersion;
|
664
663
|
keyspaces?: AWS.Keyspaces.Types.apiVersion;
|
665
664
|
billingconductor?: AWS.Billingconductor.Types.apiVersion;
|
666
|
-
gamesparks?: AWS.GameSparks.Types.apiVersion;
|
667
665
|
pinpointsmsvoicev2?: AWS.PinpointSMSVoiceV2.Types.apiVersion;
|
668
666
|
ivschat?: AWS.Ivschat.Types.apiVersion;
|
669
667
|
chimesdkmediapipelines?: AWS.ChimeSDKMediaPipelines.Types.apiVersion;
|
@@ -5,6 +5,41 @@ 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.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19
|
9
|
+
|
10
|
+
### Commits
|
11
|
+
|
12
|
+
- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d)
|
13
|
+
- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871)
|
14
|
+
|
15
|
+
## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19
|
16
|
+
|
17
|
+
## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19
|
18
|
+
|
19
|
+
### Commits
|
20
|
+
|
21
|
+
- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453)
|
22
|
+
- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5)
|
23
|
+
- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22)
|
24
|
+
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90)
|
25
|
+
- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150)
|
26
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4)
|
27
|
+
- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9)
|
28
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11)
|
29
|
+
- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5)
|
30
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd)
|
31
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8)
|
32
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff)
|
33
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223)
|
34
|
+
- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5)
|
35
|
+
- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05)
|
36
|
+
- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329)
|
37
|
+
- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958)
|
38
|
+
- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5)
|
39
|
+
- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3)
|
40
|
+
- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91)
|
41
|
+
- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60)
|
42
|
+
|
8
43
|
## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11
|
9
44
|
|
10
45
|
### Commits
|
@@ -1,2 +1,64 @@
|
|
1
|
-
# call-bind
|
1
|
+
# call-bind <sup>[![Version Badge][npm-version-svg]][package-url]</sup>
|
2
|
+
|
3
|
+
[![github actions][actions-image]][actions-url]
|
4
|
+
[![coverage][codecov-image]][codecov-url]
|
5
|
+
[![dependency status][deps-svg]][deps-url]
|
6
|
+
[![dev dependency status][dev-deps-svg]][dev-deps-url]
|
7
|
+
[![License][license-image]][license-url]
|
8
|
+
[![Downloads][downloads-image]][downloads-url]
|
9
|
+
|
10
|
+
[![npm badge][npm-badge-png]][package-url]
|
11
|
+
|
2
12
|
Robustly `.call.bind()` a function.
|
13
|
+
|
14
|
+
## Getting started
|
15
|
+
|
16
|
+
```sh
|
17
|
+
npm install --save call-bind
|
18
|
+
```
|
19
|
+
|
20
|
+
## Usage/Examples
|
21
|
+
|
22
|
+
```js
|
23
|
+
const assert = require('assert');
|
24
|
+
const callBind = require('call-bind');
|
25
|
+
const callBound = require('call-bind/callBound');
|
26
|
+
|
27
|
+
function f(a, b) {
|
28
|
+
assert.equal(this, 1);
|
29
|
+
assert.equal(a, 2);
|
30
|
+
assert.equal(b, 3);
|
31
|
+
assert.equal(arguments.length, 2);
|
32
|
+
}
|
33
|
+
|
34
|
+
const fBound = callBind(f);
|
35
|
+
|
36
|
+
const slice = callBound('Array.prototype.slice');
|
37
|
+
|
38
|
+
delete Function.prototype.call;
|
39
|
+
delete Function.prototype.bind;
|
40
|
+
|
41
|
+
fBound(1, 2, 3);
|
42
|
+
|
43
|
+
assert.deepEqual(slice([1, 2, 3, 4], 1, -1), [2, 3]);
|
44
|
+
```
|
45
|
+
|
46
|
+
## Tests
|
47
|
+
|
48
|
+
Clone the repo, `npm install`, and run `npm test`
|
49
|
+
|
50
|
+
[package-url]: https://npmjs.org/package/call-bind
|
51
|
+
[npm-version-svg]: https://versionbadg.es/ljharb/call-bind.svg
|
52
|
+
[deps-svg]: https://david-dm.org/ljharb/call-bind.svg
|
53
|
+
[deps-url]: https://david-dm.org/ljharb/call-bind
|
54
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/call-bind/dev-status.svg
|
55
|
+
[dev-deps-url]: https://david-dm.org/ljharb/call-bind#info=devDependencies
|
56
|
+
[npm-badge-png]: https://nodei.co/npm/call-bind.png?downloads=true&stars=true
|
57
|
+
[license-image]: https://img.shields.io/npm/l/call-bind.svg
|
58
|
+
[license-url]: LICENSE
|
59
|
+
[downloads-image]: https://img.shields.io/npm/dm/call-bind.svg
|
60
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=call-bind
|
61
|
+
[codecov-image]: https://codecov.io/gh/ljharb/call-bind/branch/main/graphs/badge.svg
|
62
|
+
[codecov-url]: https://app.codecov.io/gh/ljharb/call-bind/
|
63
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/call-bind
|
64
|
+
[actions-url]: https://github.com/ljharb/call-bind/actions
|
@@ -2,12 +2,13 @@
|
|
2
2
|
|
3
3
|
var bind = require('function-bind');
|
4
4
|
var GetIntrinsic = require('get-intrinsic');
|
5
|
+
var setFunctionLength = require('set-function-length');
|
5
6
|
|
7
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
6
8
|
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
7
9
|
var $call = GetIntrinsic('%Function.prototype.call%');
|
8
10
|
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
9
11
|
|
10
|
-
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
|
11
12
|
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
12
13
|
var $max = GetIntrinsic('%Math.max%');
|
13
14
|
|
@@ -21,19 +22,15 @@ if ($defineProperty) {
|
|
21
22
|
}
|
22
23
|
|
23
24
|
module.exports = function callBind(originalFunction) {
|
24
|
-
|
25
|
-
|
26
|
-
var desc = $gOPD(func, 'length');
|
27
|
-
if (desc.configurable) {
|
28
|
-
// original length, plus the receiver, minus any additional arguments (after the receiver)
|
29
|
-
$defineProperty(
|
30
|
-
func,
|
31
|
-
'length',
|
32
|
-
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
|
33
|
-
);
|
34
|
-
}
|
25
|
+
if (typeof originalFunction !== 'function') {
|
26
|
+
throw new $TypeError('a function is required');
|
35
27
|
}
|
36
|
-
|
28
|
+
var func = $reflectApply(bind, $call, arguments);
|
29
|
+
return setFunctionLength(
|
30
|
+
func,
|
31
|
+
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
32
|
+
true
|
33
|
+
);
|
37
34
|
};
|
38
35
|
|
39
36
|
var applyBind = function applyBind() {
|
@@ -1,28 +1,21 @@
|
|
1
1
|
{
|
2
2
|
"name": "call-bind",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.5",
|
4
4
|
"description": "Robustly `.call.bind()` a function",
|
5
5
|
"main": "index.js",
|
6
6
|
"exports": {
|
7
|
-
".":
|
8
|
-
|
9
|
-
"default": "./index.js"
|
10
|
-
},
|
11
|
-
"./index.js"
|
12
|
-
],
|
13
|
-
"./callBound": [
|
14
|
-
{
|
15
|
-
"default": "./callBound.js"
|
16
|
-
},
|
17
|
-
"./callBound.js"
|
18
|
-
],
|
7
|
+
".": "./index.js",
|
8
|
+
"./callBound": "./callBound.js",
|
19
9
|
"./package.json": "./package.json"
|
20
10
|
},
|
21
11
|
"scripts": {
|
22
|
-
"
|
12
|
+
"prepack": "npmignore --auto --commentLines=auto",
|
13
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
14
|
+
"prepublishOnly": "safe-publish-latest",
|
23
15
|
"lint": "eslint --ext=.js,.mjs .",
|
16
|
+
"postlint": "evalmd README.md",
|
24
17
|
"pretest": "npm run lint",
|
25
|
-
"tests-only": "nyc tape 'test
|
18
|
+
"tests-only": "nyc tape 'test/**/*.js'",
|
26
19
|
"test": "npm run tests-only",
|
27
20
|
"posttest": "aud --production",
|
28
21
|
"version": "auto-changelog && git add CHANGELOG.md",
|
@@ -57,17 +50,29 @@
|
|
57
50
|
},
|
58
51
|
"homepage": "https://github.com/ljharb/call-bind#readme",
|
59
52
|
"devDependencies": {
|
60
|
-
"@ljharb/eslint-config": "^
|
61
|
-
"aud": "^
|
62
|
-
"auto-changelog": "^2.
|
63
|
-
"
|
53
|
+
"@ljharb/eslint-config": "^21.1.0",
|
54
|
+
"aud": "^2.0.3",
|
55
|
+
"auto-changelog": "^2.4.0",
|
56
|
+
"es-value-fixtures": "^1.4.2",
|
57
|
+
"eslint": "=8.8.0",
|
58
|
+
"evalmd": "^0.0.19",
|
59
|
+
"for-each": "^0.3.3",
|
60
|
+
"gopd": "^1.0.1",
|
61
|
+
"has-strict-mode": "^1.0.1",
|
62
|
+
"in-publish": "^2.0.1",
|
63
|
+
"npmignore": "^0.3.0",
|
64
64
|
"nyc": "^10.3.2",
|
65
|
-
"
|
66
|
-
"
|
65
|
+
"object-inspect": "^1.13.1",
|
66
|
+
"safe-publish-latest": "^2.0.0",
|
67
|
+
"tape": "^5.7.1"
|
67
68
|
},
|
68
69
|
"dependencies": {
|
69
|
-
"function-bind": "^1.1.
|
70
|
-
"get-intrinsic": "^1.
|
70
|
+
"function-bind": "^1.1.2",
|
71
|
+
"get-intrinsic": "^1.2.1",
|
72
|
+
"set-function-length": "^1.1.1"
|
73
|
+
},
|
74
|
+
"testling": {
|
75
|
+
"files": "test/index.js"
|
71
76
|
},
|
72
77
|
"auto-changelog": {
|
73
78
|
"output": "CHANGELOG.md",
|
@@ -76,5 +81,10 @@
|
|
76
81
|
"commitLimit": false,
|
77
82
|
"backfillLimit": false,
|
78
83
|
"hideCredit": true
|
84
|
+
},
|
85
|
+
"publishConfig": {
|
86
|
+
"ignore": [
|
87
|
+
".github/workflows"
|
88
|
+
]
|
79
89
|
}
|
80
90
|
}
|
@@ -40,7 +40,6 @@ test('callBound', function (t) {
|
|
40
40
|
'allowMissing arg still throws for unknown intrinsic'
|
41
41
|
);
|
42
42
|
|
43
|
-
/* globals WeakRef: false */
|
44
43
|
t.test('real but absent intrinsic', { skip: typeof WeakRef !== 'undefined' }, function (st) {
|
45
44
|
st['throws'](
|
46
45
|
function () { callBound('WeakRef'); },
|
@@ -2,6 +2,11 @@
|
|
2
2
|
|
3
3
|
var callBind = require('../');
|
4
4
|
var bind = require('function-bind');
|
5
|
+
var gOPD = require('gopd');
|
6
|
+
var hasStrictMode = require('has-strict-mode')();
|
7
|
+
var forEach = require('for-each');
|
8
|
+
var inspect = require('object-inspect');
|
9
|
+
var v = require('es-value-fixtures');
|
5
10
|
|
6
11
|
var test = require('tape');
|
7
12
|
|
@@ -10,15 +15,24 @@ var test = require('tape');
|
|
10
15
|
* in io.js v3, it is configurable except on bound functions, hence the .bind()
|
11
16
|
*/
|
12
17
|
var functionsHaveConfigurableLengths = !!(
|
13
|
-
|
18
|
+
gOPD
|
19
|
+
&& Object.getOwnPropertyDescriptor
|
14
20
|
&& Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable
|
15
21
|
);
|
16
22
|
|
17
23
|
test('callBind', function (t) {
|
24
|
+
forEach(v.nonFunctions, function (nonFunction) {
|
25
|
+
t['throws'](
|
26
|
+
function () { callBind(nonFunction); },
|
27
|
+
TypeError,
|
28
|
+
inspect(nonFunction) + ' is not a function'
|
29
|
+
);
|
30
|
+
});
|
31
|
+
|
18
32
|
var sentinel = { sentinel: true };
|
19
33
|
var func = function (a, b) {
|
20
34
|
// eslint-disable-next-line no-invalid-this
|
21
|
-
return [this, a, b];
|
35
|
+
return [!hasStrictMode && this === global ? undefined : this, a, b];
|
22
36
|
};
|
23
37
|
t.equal(func.length, 2, 'original function length is 2');
|
24
38
|
t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
|
@@ -28,8 +42,8 @@ test('callBind', function (t) {
|
|
28
42
|
var bound = callBind(func);
|
29
43
|
t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
|
30
44
|
t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few args');
|
31
|
-
t.deepEqual(bound(1, 2), [1, 2, undefined], 'bound func with right args');
|
32
|
-
t.deepEqual(bound(1, 2, 3), [1, 2, 3], 'bound func with too many args');
|
45
|
+
t.deepEqual(bound(1, 2), [hasStrictMode ? 1 : Object(1), 2, undefined], 'bound func with right args');
|
46
|
+
t.deepEqual(bound(1, 2, 3), [hasStrictMode ? 1 : Object(1), 2, 3], 'bound func with too many args');
|
33
47
|
|
34
48
|
var boundR = callBind(func, sentinel);
|
35
49
|
t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
|
@@ -0,0 +1,24 @@
|
|
1
|
+
{
|
2
|
+
"root": true,
|
3
|
+
|
4
|
+
"extends": "@ljharb",
|
5
|
+
|
6
|
+
"rules": {
|
7
|
+
"complexity": 0,
|
8
|
+
"id-length": 0,
|
9
|
+
"new-cap": ["error", {
|
10
|
+
"capIsNewExceptions": [
|
11
|
+
"GetIntrinsic",
|
12
|
+
],
|
13
|
+
}],
|
14
|
+
},
|
15
|
+
|
16
|
+
"overrides": [
|
17
|
+
{
|
18
|
+
"files": "test/**",
|
19
|
+
"rules": {
|
20
|
+
"max-lines-per-function": "off",
|
21
|
+
},
|
22
|
+
},
|
23
|
+
],
|
24
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# These are supported funding model platforms
|
2
|
+
|
3
|
+
github: [ljharb]
|
4
|
+
patreon: # Replace with a single Patreon username
|
5
|
+
open_collective: # Replace with a single Open Collective username
|
6
|
+
ko_fi: # Replace with a single Ko-fi username
|
7
|
+
tidelift: npm/define-data-property
|
8
|
+
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
9
|
+
liberapay: # Replace with a single Liberapay username
|
10
|
+
issuehunt: # Replace with a single IssueHunt username
|
11
|
+
otechie: # Replace with a single Otechie username
|
12
|
+
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
@@ -0,0 +1,41 @@
|
|
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.1.1](https://github.com/ljharb/define-data-property/compare/v1.1.0...v1.1.1) - 2023-10-12
|
9
|
+
|
10
|
+
### Commits
|
11
|
+
|
12
|
+
- [Tests] fix tests in ES3 engines [`5c6920e`](https://github.com/ljharb/define-data-property/commit/5c6920edd1f52f675b02f417e539c28135b43f94)
|
13
|
+
- [Dev Deps] update `@types/es-value-fixtures`, `@types/for-each`, `@types/gopd`, `@types/has-property-descriptors`, `tape`, `typescript` [`7d82dfc`](https://github.com/ljharb/define-data-property/commit/7d82dfc20f778b4465bba06335dd53f6f431aea3)
|
14
|
+
- [Fix] IE 8 has a broken `Object.defineProperty` [`0672e1a`](https://github.com/ljharb/define-data-property/commit/0672e1af2a9fcc787e7c23b96dea60d290df5548)
|
15
|
+
- [meta] emit types on prepack [`73acb1f`](https://github.com/ljharb/define-data-property/commit/73acb1f903c21b314ec7156bf10f73c7910530c0)
|
16
|
+
- [Dev Deps] update `tape`, `typescript` [`9489a77`](https://github.com/ljharb/define-data-property/commit/9489a7738bf2ecf0ac71d5b78ec4ca6ad7ba0142)
|
17
|
+
|
18
|
+
## [v1.1.0](https://github.com/ljharb/define-data-property/compare/v1.0.1...v1.1.0) - 2023-09-13
|
19
|
+
|
20
|
+
### Commits
|
21
|
+
|
22
|
+
- [New] add `loose` arg [`155235a`](https://github.com/ljharb/define-data-property/commit/155235a4c4d7741f6de01cd87c99599a56654b72)
|
23
|
+
- [New] allow `null` to be passed for the non* args [`7d2fa5f`](https://github.com/ljharb/define-data-property/commit/7d2fa5f06be0392736c13b126f7cd38979f34792)
|
24
|
+
|
25
|
+
## [v1.0.1](https://github.com/ljharb/define-data-property/compare/v1.0.0...v1.0.1) - 2023-09-12
|
26
|
+
|
27
|
+
### Commits
|
28
|
+
|
29
|
+
- [meta] add TS types [`43d763c`](https://github.com/ljharb/define-data-property/commit/43d763c6c883f652de1c9c02ef6216ee507ffa69)
|
30
|
+
- [Dev Deps] update `@types/tape`, `typescript` [`f444985`](https://github.com/ljharb/define-data-property/commit/f444985811c36f3e6448a03ad2f9b7898917f4c7)
|
31
|
+
- [meta] add `safe-publish-latest`, [`172bb10`](https://github.com/ljharb/define-data-property/commit/172bb10890896ebb160e64398f6ee55760107bee)
|
32
|
+
|
33
|
+
## v1.0.0 - 2023-09-12
|
34
|
+
|
35
|
+
### Commits
|
36
|
+
|
37
|
+
- Initial implementation, tests, readme [`5b43d6b`](https://github.com/ljharb/define-data-property/commit/5b43d6b44e675a904810467a7d4e0adb7efc3196)
|
38
|
+
- Initial commit [`35e577a`](https://github.com/ljharb/define-data-property/commit/35e577a6ba59a98befa97776d70d90f3bea9009d)
|
39
|
+
- npm init [`82a0a04`](https://github.com/ljharb/define-data-property/commit/82a0a04a321ca7de220af02d41e2745e8a9962ed)
|
40
|
+
- Only apps should have lockfiles [`96df244`](https://github.com/ljharb/define-data-property/commit/96df244a3c6f426f9a2437be825d1c6f5dd7158e)
|
41
|
+
- [meta] use `npmignore` to autogenerate an npmignore file [`a87ff18`](https://github.com/ljharb/define-data-property/commit/a87ff18cb79e14c2eb5720486c4759fd9a189375)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 Jordan Harband
|
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,67 @@
|
|
1
|
+
# define-data-property <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
|
+
Define a data property on an object. Will fall back to assignment in an engine without descriptors.
|
11
|
+
|
12
|
+
The three `non*` argument can also be passed `null`, which will use the existing state if available.
|
13
|
+
|
14
|
+
The `loose` argument will mean that if you attempt to set a non-normal data property, in an environment without descriptor support, it will fall back to normal assignment.
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
```javascript
|
19
|
+
var defineDataProperty = require('define-data-property');
|
20
|
+
var assert = require('assert');
|
21
|
+
|
22
|
+
var obj = {};
|
23
|
+
defineDataProperty(obj, 'key', 'value');
|
24
|
+
defineDataProperty(
|
25
|
+
obj,
|
26
|
+
'key2',
|
27
|
+
'value',
|
28
|
+
true, // nonEnumerable, optional
|
29
|
+
false, // nonWritable, optional
|
30
|
+
true, // nonConfigurable, optional
|
31
|
+
false // loose, optional
|
32
|
+
);
|
33
|
+
|
34
|
+
assert.deepEqual(
|
35
|
+
Object.getOwnPropertyDescriptors(obj),
|
36
|
+
{
|
37
|
+
key: {
|
38
|
+
configurable: true,
|
39
|
+
enumerable: true,
|
40
|
+
value: 'value',
|
41
|
+
writable: true,
|
42
|
+
},
|
43
|
+
key2: {
|
44
|
+
configurable: false,
|
45
|
+
enumerable: false,
|
46
|
+
value: 'value',
|
47
|
+
writable: true,
|
48
|
+
},
|
49
|
+
}
|
50
|
+
);
|
51
|
+
```
|
52
|
+
|
53
|
+
[package-url]: https://npmjs.org/package/define-data-property
|
54
|
+
[npm-version-svg]: https://versionbadg.es/ljharb/define-data-property.svg
|
55
|
+
[deps-svg]: https://david-dm.org/ljharb/define-data-property.svg
|
56
|
+
[deps-url]: https://david-dm.org/ljharb/define-data-property
|
57
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/define-data-property/dev-status.svg
|
58
|
+
[dev-deps-url]: https://david-dm.org/ljharb/define-data-property#info=devDependencies
|
59
|
+
[npm-badge-png]: https://nodei.co/npm/define-data-property.png?downloads=true&stars=true
|
60
|
+
[license-image]: https://img.shields.io/npm/l/define-data-property.svg
|
61
|
+
[license-url]: LICENSE
|
62
|
+
[downloads-image]: https://img.shields.io/npm/dm/define-data-property.svg
|
63
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=define-data-property
|
64
|
+
[codecov-image]: https://codecov.io/gh/ljharb/define-data-property/branch/main/graphs/badge.svg
|
65
|
+
[codecov-url]: https://app.codecov.io/gh/ljharb/define-data-property/
|
66
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/define-data-property
|
67
|
+
[actions-url]: https://github.com/ljharb/define-data-property/actions
|
@@ -0,0 +1,3 @@
|
|
1
|
+
declare const _exports: (obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void;
|
2
|
+
export = _exports;
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["index.js"],"names":[],"mappings":"8BAqBiB,OAAO,WAAW,EAAE,OAAO,CAAC,YAAY,WAAW,SAAS,OAAO,kBAAkB,OAAO,GAAG,IAAI,gBAAgB,OAAO,GAAG,IAAI,oBAAoB,OAAO,GAAG,IAAI,UAAU,OAAO,KAAK,IAAI"}
|
@@ -0,0 +1,68 @@
|
|
1
|
+
'use strict';
|
2
|
+
|
3
|
+
var hasPropertyDescriptors = require('has-property-descriptors')();
|
4
|
+
|
5
|
+
var GetIntrinsic = require('get-intrinsic');
|
6
|
+
|
7
|
+
var $defineProperty = hasPropertyDescriptors && GetIntrinsic('%Object.defineProperty%', true);
|
8
|
+
if ($defineProperty) {
|
9
|
+
try {
|
10
|
+
$defineProperty({}, 'a', { value: 1 });
|
11
|
+
} catch (e) {
|
12
|
+
// IE 8 has a broken defineProperty
|
13
|
+
$defineProperty = false;
|
14
|
+
}
|
15
|
+
}
|
16
|
+
|
17
|
+
var $SyntaxError = GetIntrinsic('%SyntaxError%');
|
18
|
+
var $TypeError = GetIntrinsic('%TypeError%');
|
19
|
+
|
20
|
+
var gopd = require('gopd');
|
21
|
+
|
22
|
+
/** @type {(obj: Record<PropertyKey, unknown>, property: PropertyKey, value: unknown, nonEnumerable?: boolean | null, nonWritable?: boolean | null, nonConfigurable?: boolean | null, loose?: boolean) => void} */
|
23
|
+
module.exports = function defineDataProperty(
|
24
|
+
obj,
|
25
|
+
property,
|
26
|
+
value
|
27
|
+
) {
|
28
|
+
if (!obj || (typeof obj !== 'object' && typeof obj !== 'function')) {
|
29
|
+
throw new $TypeError('`obj` must be an object or a function`');
|
30
|
+
}
|
31
|
+
if (typeof property !== 'string' && typeof property !== 'symbol') {
|
32
|
+
throw new $TypeError('`property` must be a string or a symbol`');
|
33
|
+
}
|
34
|
+
if (arguments.length > 3 && typeof arguments[3] !== 'boolean' && arguments[3] !== null) {
|
35
|
+
throw new $TypeError('`nonEnumerable`, if provided, must be a boolean or null');
|
36
|
+
}
|
37
|
+
if (arguments.length > 4 && typeof arguments[4] !== 'boolean' && arguments[4] !== null) {
|
38
|
+
throw new $TypeError('`nonWritable`, if provided, must be a boolean or null');
|
39
|
+
}
|
40
|
+
if (arguments.length > 5 && typeof arguments[5] !== 'boolean' && arguments[5] !== null) {
|
41
|
+
throw new $TypeError('`nonConfigurable`, if provided, must be a boolean or null');
|
42
|
+
}
|
43
|
+
if (arguments.length > 6 && typeof arguments[6] !== 'boolean') {
|
44
|
+
throw new $TypeError('`loose`, if provided, must be a boolean');
|
45
|
+
}
|
46
|
+
|
47
|
+
var nonEnumerable = arguments.length > 3 ? arguments[3] : null;
|
48
|
+
var nonWritable = arguments.length > 4 ? arguments[4] : null;
|
49
|
+
var nonConfigurable = arguments.length > 5 ? arguments[5] : null;
|
50
|
+
var loose = arguments.length > 6 ? arguments[6] : false;
|
51
|
+
|
52
|
+
/* @type {false | TypedPropertyDescriptor<unknown>} */
|
53
|
+
var desc = !!gopd && gopd(obj, property);
|
54
|
+
|
55
|
+
if ($defineProperty) {
|
56
|
+
$defineProperty(obj, property, {
|
57
|
+
configurable: nonConfigurable === null && desc ? desc.configurable : !nonConfigurable,
|
58
|
+
enumerable: nonEnumerable === null && desc ? desc.enumerable : !nonEnumerable,
|
59
|
+
value: value,
|
60
|
+
writable: nonWritable === null && desc ? desc.writable : !nonWritable
|
61
|
+
});
|
62
|
+
} else if (loose || (!nonEnumerable && !nonWritable && !nonConfigurable)) {
|
63
|
+
// must fall back to [[Set]], and was not explicitly asked to make non-enumerable, non-writable, or non-configurable
|
64
|
+
obj[property] = value; // eslint-disable-line no-param-reassign
|
65
|
+
} else {
|
66
|
+
throw new $SyntaxError('This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.');
|
67
|
+
}
|
68
|
+
};
|