node-red-contrib-web-worldmap 5.1.4 → 5.1.6
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/CHANGELOG.md +2 -0
- package/README.md +5 -3
- package/examples/Moving Icons Demo & Builder.json +2 -2
- package/node-red-contrib-web-worldmap-5.1.6.tgz +0 -0
- package/node_modules/@types/geojson/README.md +1 -1
- package/node_modules/@types/geojson/index.d.ts +36 -2
- package/node_modules/@types/geojson/package.json +2 -2
- package/node_modules/{call-bind → call-bind-apply-helpers}/.eslintrc +1 -0
- package/node_modules/{has-property-descriptors → call-bind-apply-helpers}/.github/FUNDING.yml +1 -1
- package/node_modules/call-bind-apply-helpers/CHANGELOG.md +30 -0
- package/node_modules/{call-bind → 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 +64 -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 +3 -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/call-bound/.eslintrc +13 -0
- package/node_modules/{call-bind → call-bound}/.github/FUNDING.yml +1 -1
- package/node_modules/call-bound/CHANGELOG.md +42 -0
- package/node_modules/{has-property-descriptors → call-bound}/LICENSE +1 -1
- package/node_modules/call-bound/README.md +53 -0
- package/node_modules/call-bound/index.d.ts +94 -0
- package/node_modules/call-bound/index.js +19 -0
- package/node_modules/{call-bind → call-bound}/package.json +29 -25
- package/node_modules/{call-bind/test/callBound.js → call-bound/test/index.js} +12 -5
- package/node_modules/call-bound/tsconfig.json +10 -0
- package/node_modules/compression/HISTORY.md +9 -1
- package/node_modules/compression/README.md +103 -30
- package/node_modules/compression/index.js +55 -13
- package/node_modules/compression/package.json +3 -2
- package/node_modules/{define-data-property → dunder-proto}/.github/FUNDING.yml +1 -1
- package/node_modules/dunder-proto/CHANGELOG.md +24 -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 +30 -0
- package/node_modules/{has-proto → dunder-proto}/package.json +34 -36
- package/node_modules/dunder-proto/set.d.ts +5 -0
- package/node_modules/dunder-proto/set.js +35 -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 +50 -0
- package/node_modules/dunder-proto/tsconfig.json +9 -0
- 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/es-object-atoms/.eslintrc +16 -0
- package/node_modules/{set-function-length → es-object-atoms}/.github/FUNDING.yml +1 -1
- package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
- package/node_modules/{define-data-property → es-object-atoms}/LICENSE +1 -1
- package/node_modules/es-object-atoms/README.md +63 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
- package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
- package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
- package/node_modules/es-object-atoms/ToObject.js +10 -0
- package/node_modules/es-object-atoms/index.d.ts +3 -0
- package/node_modules/es-object-atoms/index.js +4 -0
- package/node_modules/es-object-atoms/isObject.d.ts +3 -0
- package/node_modules/es-object-atoms/isObject.js +6 -0
- package/node_modules/es-object-atoms/package.json +80 -0
- package/node_modules/es-object-atoms/test/index.js +38 -0
- package/node_modules/es-object-atoms/tsconfig.json +6 -0
- package/node_modules/get-intrinsic/.eslintrc +4 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +43 -0
- package/node_modules/get-intrinsic/index.js +40 -21
- package/node_modules/get-intrinsic/package.json +24 -20
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +2 -2
- package/node_modules/get-proto/.eslintrc +10 -0
- package/node_modules/{has-proto → get-proto}/.github/FUNDING.yml +1 -1
- package/node_modules/get-proto/.nycrc +9 -0
- package/node_modules/get-proto/CHANGELOG.md +21 -0
- package/node_modules/{has-proto → get-proto}/LICENSE +1 -1
- package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
- package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
- package/node_modules/get-proto/README.md +50 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
- package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
- package/node_modules/get-proto/index.d.ts +5 -0
- package/node_modules/get-proto/index.js +27 -0
- package/node_modules/{has-property-descriptors → get-proto}/package.json +35 -31
- package/node_modules/get-proto/test/index.js +68 -0
- package/node_modules/get-proto/tsconfig.json +9 -0
- package/node_modules/gopd/CHANGELOG.md +20 -0
- package/node_modules/gopd/gOPD.d.ts +1 -0
- package/node_modules/gopd/gOPD.js +4 -0
- package/node_modules/gopd/index.d.ts +5 -0
- package/node_modules/gopd/index.js +2 -3
- package/node_modules/gopd/package.json +16 -10
- package/node_modules/gopd/test/index.js +2 -1
- package/node_modules/has-symbols/CHANGELOG.md +16 -0
- package/node_modules/has-symbols/index.d.ts +3 -0
- package/node_modules/has-symbols/index.js +1 -0
- package/node_modules/has-symbols/package.json +19 -9
- package/node_modules/has-symbols/shams.d.ts +3 -0
- package/node_modules/has-symbols/shams.js +5 -2
- package/node_modules/has-symbols/test/shams/core-js.js +1 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +1 -0
- package/node_modules/has-symbols/test/tests.js +4 -2
- package/node_modules/has-symbols/tsconfig.json +10 -0
- package/node_modules/http-parser-js/http-parser.d.ts +6 -0
- package/node_modules/http-parser-js/http-parser.js +16 -9
- package/node_modules/http-parser-js/package.json +1 -1
- package/node_modules/math-intrinsics/.eslintrc +16 -0
- package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
- package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
- package/node_modules/math-intrinsics/LICENSE +21 -0
- package/node_modules/math-intrinsics/README.md +50 -0
- package/node_modules/math-intrinsics/abs.d.ts +1 -0
- package/node_modules/math-intrinsics/abs.js +4 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
- package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
- package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
- package/node_modules/math-intrinsics/floor.d.ts +1 -0
- package/node_modules/math-intrinsics/floor.js +4 -0
- package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
- package/node_modules/math-intrinsics/isFinite.js +12 -0
- package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
- package/node_modules/math-intrinsics/isInteger.js +16 -0
- package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
- package/node_modules/math-intrinsics/isNaN.js +6 -0
- package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
- package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
- package/node_modules/math-intrinsics/max.d.ts +1 -0
- package/node_modules/math-intrinsics/max.js +4 -0
- package/node_modules/math-intrinsics/min.d.ts +1 -0
- package/node_modules/math-intrinsics/min.js +4 -0
- package/node_modules/math-intrinsics/mod.d.ts +3 -0
- package/node_modules/math-intrinsics/mod.js +9 -0
- package/node_modules/math-intrinsics/package.json +86 -0
- package/node_modules/math-intrinsics/pow.d.ts +1 -0
- package/node_modules/math-intrinsics/pow.js +4 -0
- package/node_modules/math-intrinsics/round.d.ts +1 -0
- package/node_modules/math-intrinsics/round.js +4 -0
- package/node_modules/math-intrinsics/sign.d.ts +3 -0
- package/node_modules/math-intrinsics/sign.js +11 -0
- package/node_modules/math-intrinsics/test/index.js +192 -0
- package/node_modules/math-intrinsics/tsconfig.json +3 -0
- package/node_modules/mime-db/HISTORY.md +21 -1
- package/node_modules/mime-db/README.md +7 -1
- package/node_modules/mime-db/db.json +252 -13
- package/node_modules/mime-db/package.json +4 -4
- package/node_modules/object-inspect/CHANGELOG.md +8 -0
- package/node_modules/object-inspect/index.js +10 -7
- package/node_modules/object-inspect/package.json +5 -4
- package/node_modules/object-inspect/test/values.js +50 -0
- package/node_modules/side-channel/.eslintrc +1 -0
- package/node_modules/side-channel/CHANGELOG.md +15 -0
- package/node_modules/side-channel/README.md +60 -1
- package/node_modules/side-channel/index.d.ts +9 -22
- package/node_modules/side-channel/index.js +20 -106
- package/node_modules/side-channel/package.json +20 -19
- package/node_modules/side-channel/test/index.js +76 -55
- package/node_modules/side-channel/tsconfig.json +2 -43
- package/node_modules/side-channel-list/.editorconfig +9 -0
- package/node_modules/side-channel-list/.eslintrc +11 -0
- package/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-list/CHANGELOG.md +15 -0
- package/node_modules/side-channel-list/LICENSE +21 -0
- package/node_modules/side-channel-list/README.md +62 -0
- package/node_modules/side-channel-list/index.d.ts +13 -0
- package/node_modules/side-channel-list/index.js +113 -0
- package/node_modules/side-channel-list/list.d.ts +14 -0
- package/node_modules/side-channel-list/package.json +77 -0
- package/node_modules/side-channel-list/test/index.js +104 -0
- package/node_modules/side-channel-list/tsconfig.json +9 -0
- package/node_modules/side-channel-map/.editorconfig +9 -0
- package/node_modules/side-channel-map/.eslintrc +11 -0
- package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-map/.nycrc +13 -0
- package/node_modules/side-channel-map/CHANGELOG.md +22 -0
- package/node_modules/side-channel-map/LICENSE +21 -0
- package/node_modules/side-channel-map/README.md +62 -0
- package/node_modules/side-channel-map/index.d.ts +15 -0
- package/node_modules/side-channel-map/index.js +68 -0
- package/node_modules/side-channel-map/package.json +80 -0
- package/node_modules/side-channel-map/test/index.js +114 -0
- package/node_modules/side-channel-map/tsconfig.json +9 -0
- package/node_modules/side-channel-weakmap/.editorconfig +9 -0
- package/node_modules/side-channel-weakmap/.eslintrc +12 -0
- package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel-weakmap/.nycrc +13 -0
- package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
- package/node_modules/side-channel-weakmap/LICENSE +21 -0
- package/node_modules/side-channel-weakmap/README.md +62 -0
- package/node_modules/side-channel-weakmap/index.d.ts +15 -0
- package/node_modules/side-channel-weakmap/index.js +84 -0
- package/node_modules/side-channel-weakmap/package.json +87 -0
- package/node_modules/side-channel-weakmap/test/index.js +114 -0
- package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
- package/package.json +2 -2
- package/worldmap/worldmap.js +18 -13
- package/worldmap.html +2 -2
- package/node_modules/call-bind/.eslintignore +0 -1
- package/node_modules/call-bind/CHANGELOG.md +0 -93
- package/node_modules/call-bind/README.md +0 -64
- package/node_modules/call-bind/callBound.js +0 -15
- package/node_modules/call-bind/index.js +0 -35
- package/node_modules/call-bind/test/index.js +0 -80
- package/node_modules/define-data-property/.eslintrc +0 -24
- package/node_modules/define-data-property/CHANGELOG.md +0 -70
- package/node_modules/define-data-property/README.md +0 -67
- package/node_modules/define-data-property/index.d.ts +0 -12
- package/node_modules/define-data-property/index.js +0 -56
- package/node_modules/define-data-property/package.json +0 -106
- package/node_modules/define-data-property/test/index.js +0 -392
- package/node_modules/define-data-property/tsconfig.json +0 -59
- package/node_modules/has-property-descriptors/.eslintrc +0 -13
- package/node_modules/has-property-descriptors/CHANGELOG.md +0 -35
- package/node_modules/has-property-descriptors/README.md +0 -43
- package/node_modules/has-property-descriptors/index.js +0 -22
- package/node_modules/has-property-descriptors/test/index.js +0 -57
- package/node_modules/has-proto/CHANGELOG.md +0 -38
- package/node_modules/has-proto/README.md +0 -38
- package/node_modules/has-proto/index.d.ts +0 -3
- package/node_modules/has-proto/index.js +0 -15
- package/node_modules/has-proto/test/index.js +0 -19
- package/node_modules/has-proto/tsconfig.json +0 -49
- package/node_modules/set-function-length/.eslintrc +0 -27
- package/node_modules/set-function-length/CHANGELOG.md +0 -70
- package/node_modules/set-function-length/LICENSE +0 -21
- package/node_modules/set-function-length/README.md +0 -56
- package/node_modules/set-function-length/env.d.ts +0 -9
- package/node_modules/set-function-length/env.js +0 -25
- package/node_modules/set-function-length/index.d.ts +0 -7
- package/node_modules/set-function-length/index.js +0 -42
- package/node_modules/set-function-length/package.json +0 -102
- /package/node_modules/{call-bind → call-bind-apply-helpers}/.nycrc +0 -0
- /package/node_modules/{has-property-descriptors → call-bound}/.nycrc +0 -0
- /package/node_modules/{has-proto → dunder-proto}/.eslintrc +0 -0
- /package/node_modules/{define-data-property → dunder-proto}/.nycrc +0 -0
- /package/node_modules/{set-function-length → gopd}/tsconfig.json +0 -0
- /package/node_modules/{set-function-length → side-channel-list}/.nycrc +0 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "side-channel-weakmap",
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "Store information about any JS value in a side channel. Uses WeakMap if available.",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./package.json": "./package.json"
|
|
9
|
+
},
|
|
10
|
+
"types": "./index.d.ts",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"prepack": "npmignore --auto --commentLines=autogenerated",
|
|
13
|
+
"prepublishOnly": "safe-publish-latest",
|
|
14
|
+
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
15
|
+
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
|
16
|
+
"lint": "eslint --ext=js,mjs .",
|
|
17
|
+
"postlint": "tsc -p . && attw -P",
|
|
18
|
+
"pretest": "npm run lint",
|
|
19
|
+
"tests-only": "nyc tape 'test/**/*.js'",
|
|
20
|
+
"test": "npm run tests-only",
|
|
21
|
+
"posttest": "npx npm@'>=10.2' audit --production",
|
|
22
|
+
"version": "auto-changelog && git add CHANGELOG.md",
|
|
23
|
+
"postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\""
|
|
24
|
+
},
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "git+https://github.com/ljharb/side-channel-weakmap.git"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"weakmap",
|
|
31
|
+
"map",
|
|
32
|
+
"side",
|
|
33
|
+
"channel",
|
|
34
|
+
"metadata"
|
|
35
|
+
],
|
|
36
|
+
"author": "Jordan Harband <ljharb@gmail.com>",
|
|
37
|
+
"funding": {
|
|
38
|
+
"url": "https://github.com/sponsors/ljharb"
|
|
39
|
+
},
|
|
40
|
+
"license": "MIT",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/ljharb/side-channel-weakmap/issues"
|
|
43
|
+
},
|
|
44
|
+
"homepage": "https://github.com/ljharb/side-channel-weakmap#readme",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"call-bound": "^1.0.2",
|
|
47
|
+
"es-errors": "^1.3.0",
|
|
48
|
+
"get-intrinsic": "^1.2.5",
|
|
49
|
+
"object-inspect": "^1.13.3",
|
|
50
|
+
"side-channel-map": "^1.0.1"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@arethetypeswrong/cli": "^0.17.1",
|
|
54
|
+
"@ljharb/eslint-config": "^21.1.1",
|
|
55
|
+
"@ljharb/tsconfig": "^0.2.2",
|
|
56
|
+
"@types/call-bind": "^1.0.5",
|
|
57
|
+
"@types/get-intrinsic": "^1.2.3",
|
|
58
|
+
"@types/object-inspect": "^1.13.0",
|
|
59
|
+
"@types/tape": "^5.6.5",
|
|
60
|
+
"auto-changelog": "^2.5.0",
|
|
61
|
+
"eclint": "^2.8.1",
|
|
62
|
+
"encoding": "^0.1.13",
|
|
63
|
+
"eslint": "=8.8.0",
|
|
64
|
+
"in-publish": "^2.0.1",
|
|
65
|
+
"npmignore": "^0.3.1",
|
|
66
|
+
"nyc": "^10.3.2",
|
|
67
|
+
"safe-publish-latest": "^2.0.0",
|
|
68
|
+
"tape": "^5.9.0",
|
|
69
|
+
"typescript": "next"
|
|
70
|
+
},
|
|
71
|
+
"auto-changelog": {
|
|
72
|
+
"output": "CHANGELOG.md",
|
|
73
|
+
"template": "keepachangelog",
|
|
74
|
+
"unreleased": false,
|
|
75
|
+
"commitLimit": false,
|
|
76
|
+
"backfillLimit": false,
|
|
77
|
+
"hideCredit": true
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"ignore": [
|
|
81
|
+
".github/workflows"
|
|
82
|
+
]
|
|
83
|
+
},
|
|
84
|
+
"engines": {
|
|
85
|
+
"node": ">= 0.4"
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var test = require('tape');
|
|
4
|
+
|
|
5
|
+
var getSideChannelWeakMap = require('../');
|
|
6
|
+
|
|
7
|
+
test('getSideChannelMap', { skip: typeof WeakMap !== 'function' && typeof Map !== 'function' }, function (t) {
|
|
8
|
+
var getSideChannel = getSideChannelWeakMap || function () {
|
|
9
|
+
throw new EvalError('should never happen');
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
t.test('export', function (st) {
|
|
13
|
+
st.equal(typeof getSideChannel, 'function', 'is a function');
|
|
14
|
+
|
|
15
|
+
st.equal(getSideChannel.length, 0, 'takes no arguments');
|
|
16
|
+
|
|
17
|
+
var channel = getSideChannel();
|
|
18
|
+
st.ok(channel, 'is truthy');
|
|
19
|
+
st.equal(typeof channel, 'object', 'is an object');
|
|
20
|
+
st.end();
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
t.test('assert', function (st) {
|
|
24
|
+
var channel = getSideChannel();
|
|
25
|
+
st['throws'](
|
|
26
|
+
function () { channel.assert({}); },
|
|
27
|
+
TypeError,
|
|
28
|
+
'nonexistent value throws'
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
var o = {};
|
|
32
|
+
channel.set(o, 'data');
|
|
33
|
+
st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
|
|
34
|
+
|
|
35
|
+
st.end();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
t.test('has', function (st) {
|
|
39
|
+
var channel = getSideChannel();
|
|
40
|
+
/** @type {unknown[]} */ var o = [];
|
|
41
|
+
|
|
42
|
+
st.equal(channel.has(o), false, 'nonexistent value yields false');
|
|
43
|
+
|
|
44
|
+
channel.set(o, 'foo');
|
|
45
|
+
st.equal(channel.has(o), true, 'existent value yields true');
|
|
46
|
+
|
|
47
|
+
st.equal(channel.has('abc'), false, 'non object value non existent yields false');
|
|
48
|
+
|
|
49
|
+
channel.set('abc', 'foo');
|
|
50
|
+
st.equal(channel.has('abc'), true, 'non object value that exists yields true');
|
|
51
|
+
|
|
52
|
+
st.end();
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
t.test('get', function (st) {
|
|
56
|
+
var channel = getSideChannel();
|
|
57
|
+
var o = {};
|
|
58
|
+
st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
|
|
59
|
+
|
|
60
|
+
var data = {};
|
|
61
|
+
channel.set(o, data);
|
|
62
|
+
st.equal(channel.get(o), data, '"get" yields data set by "set"');
|
|
63
|
+
|
|
64
|
+
st.end();
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
t.test('set', function (st) {
|
|
68
|
+
var channel = getSideChannel();
|
|
69
|
+
var o = function () {};
|
|
70
|
+
st.equal(channel.get(o), undefined, 'value not set');
|
|
71
|
+
|
|
72
|
+
channel.set(o, 42);
|
|
73
|
+
st.equal(channel.get(o), 42, 'value was set');
|
|
74
|
+
|
|
75
|
+
channel.set(o, Infinity);
|
|
76
|
+
st.equal(channel.get(o), Infinity, 'value was set again');
|
|
77
|
+
|
|
78
|
+
var o2 = {};
|
|
79
|
+
channel.set(o2, 17);
|
|
80
|
+
st.equal(channel.get(o), Infinity, 'o is not modified');
|
|
81
|
+
st.equal(channel.get(o2), 17, 'o2 is set');
|
|
82
|
+
|
|
83
|
+
channel.set(o, 14);
|
|
84
|
+
st.equal(channel.get(o), 14, 'o is modified');
|
|
85
|
+
st.equal(channel.get(o2), 17, 'o2 is not modified');
|
|
86
|
+
|
|
87
|
+
st.end();
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
t.test('delete', function (st) {
|
|
91
|
+
var channel = getSideChannel();
|
|
92
|
+
var o = {};
|
|
93
|
+
st.equal(channel['delete']({}), false, 'nonexistent value yields false');
|
|
94
|
+
|
|
95
|
+
channel.set(o, 42);
|
|
96
|
+
st.equal(channel.has(o), true, 'value is set');
|
|
97
|
+
|
|
98
|
+
st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
|
|
99
|
+
|
|
100
|
+
st.equal(channel['delete'](o), true, 'deleted value yields true');
|
|
101
|
+
|
|
102
|
+
st.equal(channel.has(o), false, 'value is no longer set');
|
|
103
|
+
|
|
104
|
+
st.end();
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
t.end();
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('getSideChannelMap, no WeakMaps and/or Maps', { skip: typeof WeakMap === 'function' || typeof Map === 'function' }, function (t) {
|
|
111
|
+
t.equal(getSideChannelWeakMap, false, 'is false');
|
|
112
|
+
|
|
113
|
+
t.end();
|
|
114
|
+
});
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-red-contrib-web-worldmap",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.6",
|
|
4
4
|
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@turf/bezier-spline": "~7.2.0",
|
|
7
7
|
"cgi": "0.3.1",
|
|
8
|
-
"compression": "^1.
|
|
8
|
+
"compression": "^1.8.0",
|
|
9
9
|
"express": "^4.21.2",
|
|
10
10
|
"sockjs": "~0.3.24"
|
|
11
11
|
},
|
package/worldmap/worldmap.js
CHANGED
|
@@ -878,7 +878,7 @@ map.on('locationerror', onLocationError);
|
|
|
878
878
|
|
|
879
879
|
// single right click to add a marker
|
|
880
880
|
var addmenu = "<b>Add marker</b><br><input type='text' id='rinput' autofocus onkeydown='if (event.keyCode == 13) addThing();' placeholder='name (,icon/SIDC, layer, colour, heading)'/>";
|
|
881
|
-
|
|
881
|
+
addmenu += '<br/><a href="unitgenerator.html" target="_new">MilSymbol SIDC generator</a>';
|
|
882
882
|
var rightmenuMap = L.popup({keepInView:true, minWidth:260}).setContent(addmenu);
|
|
883
883
|
|
|
884
884
|
const rgba2hex = (rgba) => `#${rgba.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+\.{0,1}\d*))?\)$/).slice(1).map((n, i) => (i === 3 ? Math.round(parseFloat(n) * 255) : parseFloat(n)).toString(16).padStart(2, '0').replace('NaN', '')).join('')}`;
|
|
@@ -3472,18 +3472,23 @@ function createRings(r) {
|
|
|
3472
3472
|
|
|
3473
3473
|
function handleCoTtypes(d,p) {
|
|
3474
3474
|
if (d.type.indexOf('a-') === 0) { // handle a- types
|
|
3475
|
-
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3475
|
+
if (p?.detail?.__milsym?.id) {
|
|
3476
|
+
d.SIDC = p.detail.__milsym.id;
|
|
3477
|
+
}
|
|
3478
|
+
else {
|
|
3479
|
+
var i = d.type.split('-').join('').toUpperCase();
|
|
3480
|
+
i = 'S' + i.substr(1,2) + 'P' + i.substr(3);
|
|
3481
|
+
if (d.role === 'Team Lead') { i = i + '----B'; }
|
|
3482
|
+
if (d.role === 'HQ') { i = 'SFGPUH' };
|
|
3483
|
+
if (d.role === "Medic") { i = 'SFGPUSM----A'; }
|
|
3484
|
+
if (d.role === "RTO") { i = 'SFGPUUS'; }
|
|
3485
|
+
if (d.role === 'K9') { i = 'SFGPUU'; }
|
|
3486
|
+
d.SIDC = (i + '-------').substr(0,12);
|
|
3487
|
+
// Handle "special" types
|
|
3488
|
+
if (d.type === "a-h-X-i-o") { d.SIDC = "EHIP--------" }
|
|
3489
|
+
if (d.type === "a-h-X-i-m-d") { d.SIDC = "EHNPBB------" }
|
|
3490
|
+
if (d.type === "a-h-X-i-g-e") { d.SIDC = "EHNPAC------" }
|
|
3491
|
+
}
|
|
3487
3492
|
return d;
|
|
3488
3493
|
}
|
|
3489
3494
|
else { // handle b- types
|
package/worldmap.html
CHANGED
|
@@ -146,7 +146,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
146
146
|
<p>Icons of type <i>plane</i>, <i>ship</i>, <i>car</i>, <i>uav</i> or <i>arrow</i> will use built in SVG icons that align to the
|
|
147
147
|
<code>bearing</code> value.</p>
|
|
148
148
|
<p>Font Awesome (<a href="https://fontawesome.com/v4.7.0/icons/" target="_new">fa-icons 4.7</a>) can also be used, as can
|
|
149
|
-
NATO symbology codes (<a href="
|
|
149
|
+
NATO symbology codes (<a href="worldmap/unitgenerator.html">SIDC</a>), or <a href="https://github.com/dceejay/RedMap/blob/master/emojilist.md" target="_new">:emoji name:</a>,
|
|
150
150
|
or the url of a small icon image (32x32)</p>
|
|
151
151
|
<p>See the <a href="https://www.npmjs.com/package/node-red-contrib-web-worldmap" target="_new">README</a> for further
|
|
152
152
|
details and examples of icons and commands for drawing <b>lines</b> and <b>areas</b>, and to <b>add layers</b> and
|
|
@@ -312,7 +312,7 @@ If <i>Web Path</i> is left empty, then by default <code>⌘⇧m</code> - <code>c
|
|
|
312
312
|
<p>Icons of type <i>plane</i>, <i>ship</i>, <i>car</i>, <i>uav</i> or <i>arrow</i> will use built in SVG icons that align to the
|
|
313
313
|
<code>bearing</code> value.</p>
|
|
314
314
|
<p>Font Awesome (<a href="https://fontawesome.com/v4.7.0/icons/" target="_new">fa-icons 4.7</a>) can also be used, as can
|
|
315
|
-
NATO symbology codes (<a href="
|
|
315
|
+
NATO symbology codes (<a href="worldmap/unitgenerator.html">SIDC</a>), or <a href="https://github.com/dceejay/RedMap/blob/master/emojilist.md" target="_new">:emoji name:</a>,
|
|
316
316
|
or the url of a small icon image (32x32)</p>
|
|
317
317
|
<p>See the <a href="https://www.npmjs.com/package/node-red-contrib-web-worldmap" target="_new">README</a> for further
|
|
318
318
|
details and examples of icons and commands for drawing <b>lines</b> and <b>areas</b>, and to <b>add layers</b> and
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
coverage/
|
|
@@ -1,93 +0,0 @@
|
|
|
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.7](https://github.com/ljharb/call-bind/compare/v1.0.6...v1.0.7) - 2024-02-12
|
|
9
|
-
|
|
10
|
-
### Commits
|
|
11
|
-
|
|
12
|
-
- [Refactor] use `es-define-property` [`09b76a0`](https://github.com/ljharb/call-bind/commit/09b76a01634440461d44a80c9924ec4b500f3b03)
|
|
13
|
-
- [Deps] update `get-intrinsic`, `set-function-length` [`ad5136d`](https://github.com/ljharb/call-bind/commit/ad5136ddda2a45c590959829ad3dce0c9f4e3590)
|
|
14
|
-
|
|
15
|
-
## [v1.0.6](https://github.com/ljharb/call-bind/compare/v1.0.5...v1.0.6) - 2024-02-05
|
|
16
|
-
|
|
17
|
-
### Commits
|
|
18
|
-
|
|
19
|
-
- [Dev Deps] update `aud`, `npmignore`, `tape` [`d564d5c`](https://github.com/ljharb/call-bind/commit/d564d5ce3e06a19df4d499c77f8d1a9da44e77aa)
|
|
20
|
-
- [Deps] update `get-intrinsic`, `set-function-length` [`cfc2bdc`](https://github.com/ljharb/call-bind/commit/cfc2bdca7b633df0e0e689e6b637f668f1c6792e)
|
|
21
|
-
- [Refactor] use `es-errors`, so things that only need those do not need `get-intrinsic` [`64cd289`](https://github.com/ljharb/call-bind/commit/64cd289ae5862c250a4ca80aa8d461047c166af5)
|
|
22
|
-
- [meta] add missing `engines.node` [`32a4038`](https://github.com/ljharb/call-bind/commit/32a4038857b62179f7f9b7b3df2c5260036be582)
|
|
23
|
-
|
|
24
|
-
## [v1.0.5](https://github.com/ljharb/call-bind/compare/v1.0.4...v1.0.5) - 2023-10-19
|
|
25
|
-
|
|
26
|
-
### Commits
|
|
27
|
-
|
|
28
|
-
- [Fix] throw an error on non-functions as early as possible [`f262408`](https://github.com/ljharb/call-bind/commit/f262408f822c840fbc268080f3ad7c429611066d)
|
|
29
|
-
- [Deps] update `set-function-length` [`3fff271`](https://github.com/ljharb/call-bind/commit/3fff27145a1e3a76a5b74f1d7c3c43d0fa3b9871)
|
|
30
|
-
|
|
31
|
-
## [v1.0.4](https://github.com/ljharb/call-bind/compare/v1.0.3...v1.0.4) - 2023-10-19
|
|
32
|
-
|
|
33
|
-
## [v1.0.3](https://github.com/ljharb/call-bind/compare/v1.0.2...v1.0.3) - 2023-10-19
|
|
34
|
-
|
|
35
|
-
### Commits
|
|
36
|
-
|
|
37
|
-
- [actions] reuse common workflows [`a994df6`](https://github.com/ljharb/call-bind/commit/a994df69f401f4bf735a4ccd77029b85d1549453)
|
|
38
|
-
- [meta] use `npmignore` to autogenerate an npmignore file [`eef3ef2`](https://github.com/ljharb/call-bind/commit/eef3ef21e1f002790837fedb8af2679c761fbdf5)
|
|
39
|
-
- [readme] flesh out content [`1845ccf`](https://github.com/ljharb/call-bind/commit/1845ccfd9976a607884cfc7157c93192cc16cf22)
|
|
40
|
-
- [actions] use `node/install` instead of `node/run`; use `codecov` action [`5b47d53`](https://github.com/ljharb/call-bind/commit/5b47d53d2fd74af5ea0a44f1d51e503cd42f7a90)
|
|
41
|
-
- [Refactor] use `set-function-length` [`a0e165c`](https://github.com/ljharb/call-bind/commit/a0e165c5dc61db781cbc919b586b1c2b8da0b150)
|
|
42
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`9c50103`](https://github.com/ljharb/call-bind/commit/9c50103f44137279a817317cf6cc421a658f85b4)
|
|
43
|
-
- [meta] simplify "exports" [`019c6d0`](https://github.com/ljharb/call-bind/commit/019c6d06b0e1246ceed8e579f57e44441cbbf6d9)
|
|
44
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `safe-publish-latest`, `tape` [`23bd718`](https://github.com/ljharb/call-bind/commit/23bd718a288d3b03042062b4ef5153b3cea83f11)
|
|
45
|
-
- [actions] update codecov uploader [`62552d7`](https://github.com/ljharb/call-bind/commit/62552d79cc79e05825e99aaba134ae5b37f33da5)
|
|
46
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `auto-changelog`, `tape` [`ec81665`](https://github.com/ljharb/call-bind/commit/ec81665b300f87eabff597afdc8b8092adfa7afd)
|
|
47
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `safe-publish-latest`, `tape` [`35d67fc`](https://github.com/ljharb/call-bind/commit/35d67fcea883e686650f736f61da5ddca2592de8)
|
|
48
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`0266d8d`](https://github.com/ljharb/call-bind/commit/0266d8d2a45086a922db366d0c2932fa463662ff)
|
|
49
|
-
- [Dev Deps] update `@ljharb/eslint-config`, `aud`, `tape` [`43a5b28`](https://github.com/ljharb/call-bind/commit/43a5b28a444e710e1bbf92adb8afb5cf7523a223)
|
|
50
|
-
- [Deps] update `define-data-property`, `function-bind`, `get-intrinsic` [`780eb36`](https://github.com/ljharb/call-bind/commit/780eb36552514f8cc99c70821ce698697c2726a5)
|
|
51
|
-
- [Dev Deps] update `aud`, `tape` [`90d50ad`](https://github.com/ljharb/call-bind/commit/90d50ad03b061e0268b3380b0065fcaec183dc05)
|
|
52
|
-
- [meta] use `prepublishOnly` script for npm 7+ [`44c5433`](https://github.com/ljharb/call-bind/commit/44c5433b7980e02b4870007046407cf6fc543329)
|
|
53
|
-
- [Deps] update `get-intrinsic` [`86bfbfc`](https://github.com/ljharb/call-bind/commit/86bfbfcf34afdc6eabc93ce3d408548d0e27d958)
|
|
54
|
-
- [Deps] update `get-intrinsic` [`5c53354`](https://github.com/ljharb/call-bind/commit/5c5335489be0294c18cd7a8bb6e08226ee019ff5)
|
|
55
|
-
- [actions] update checkout action [`4c393a8`](https://github.com/ljharb/call-bind/commit/4c393a8173b3c8e5b30d5b3297b3b94d48bf87f3)
|
|
56
|
-
- [Deps] update `get-intrinsic` [`4e70bde`](https://github.com/ljharb/call-bind/commit/4e70bdec0626acb11616d66250fc14565e716e91)
|
|
57
|
-
- [Deps] update `get-intrinsic` [`55ae803`](https://github.com/ljharb/call-bind/commit/55ae803a920bd93c369cd798c20de31f91e9fc60)
|
|
58
|
-
|
|
59
|
-
## [v1.0.2](https://github.com/ljharb/call-bind/compare/v1.0.1...v1.0.2) - 2021-01-11
|
|
60
|
-
|
|
61
|
-
### Commits
|
|
62
|
-
|
|
63
|
-
- [Fix] properly include the receiver in the bound length [`dbae7bc`](https://github.com/ljharb/call-bind/commit/dbae7bc676c079a0d33c0a43e9ef92cb7b01345d)
|
|
64
|
-
|
|
65
|
-
## [v1.0.1](https://github.com/ljharb/call-bind/compare/v1.0.0...v1.0.1) - 2021-01-08
|
|
66
|
-
|
|
67
|
-
### Commits
|
|
68
|
-
|
|
69
|
-
- [Tests] migrate tests to Github Actions [`b6db284`](https://github.com/ljharb/call-bind/commit/b6db284c36f8ccd195b88a6764fe84b7223a0da1)
|
|
70
|
-
- [meta] do not publish github action workflow files [`ec7fe46`](https://github.com/ljharb/call-bind/commit/ec7fe46e60cfa4764ee943d2755f5e5a366e578e)
|
|
71
|
-
- [Fix] preserve original function’s length when possible [`adbceaa`](https://github.com/ljharb/call-bind/commit/adbceaa3cac4b41ea78bb19d7ccdbaaf7e0bdadb)
|
|
72
|
-
- [Tests] gather coverage data on every job [`d69e23c`](https://github.com/ljharb/call-bind/commit/d69e23cc65f101ba1d4c19bb07fa8eb0ec624be8)
|
|
73
|
-
- [Dev Deps] update `eslint`, `@ljharb/eslint-config`, `aud`, `tape` [`2fd3586`](https://github.com/ljharb/call-bind/commit/2fd3586c5d47b335364c14293114c6b625ae1f71)
|
|
74
|
-
- [Deps] update `get-intrinsic` [`f23e931`](https://github.com/ljharb/call-bind/commit/f23e9318cc271c2add8bb38cfded85ee7baf8eee)
|
|
75
|
-
- [Deps] update `get-intrinsic` [`72d9f44`](https://github.com/ljharb/call-bind/commit/72d9f44e184465ba8dd3fb48260bbcff234985f2)
|
|
76
|
-
- [meta] fix FUNDING.yml [`e723573`](https://github.com/ljharb/call-bind/commit/e723573438c5a68dcec31fb5d96ea6b7e4a93be8)
|
|
77
|
-
- [eslint] ignore coverage output [`15e76d2`](https://github.com/ljharb/call-bind/commit/15e76d28a5f43e504696401e5b31ebb78ee1b532)
|
|
78
|
-
- [meta] add Automatic Rebase and Require Allow Edits workflows [`8fa4dab`](https://github.com/ljharb/call-bind/commit/8fa4dabb23ba3dd7bb92c9571c1241c08b56e4b6)
|
|
79
|
-
|
|
80
|
-
## v1.0.0 - 2020-10-30
|
|
81
|
-
|
|
82
|
-
### Commits
|
|
83
|
-
|
|
84
|
-
- Initial commit [`306cf98`](https://github.com/ljharb/call-bind/commit/306cf98c7ec9e7ef66b653ec152277ac1381eb50)
|
|
85
|
-
- Tests [`e10d0bb`](https://github.com/ljharb/call-bind/commit/e10d0bbdadc7a10ecedc9a1c035112d3e368b8df)
|
|
86
|
-
- Implementation [`43852ed`](https://github.com/ljharb/call-bind/commit/43852eda0f187327b7fad2423ca972149a52bd65)
|
|
87
|
-
- npm init [`408f860`](https://github.com/ljharb/call-bind/commit/408f860b773a2f610805fd3613d0d71bac1b6249)
|
|
88
|
-
- [meta] add Automatic Rebase and Require Allow Edits workflows [`fb349b2`](https://github.com/ljharb/call-bind/commit/fb349b2e48defbec8b5ec8a8395cc8f69f220b13)
|
|
89
|
-
- [meta] add `auto-changelog` [`c4001fc`](https://github.com/ljharb/call-bind/commit/c4001fc43031799ef908211c98d3b0fb2b60fde4)
|
|
90
|
-
- [meta] add "funding"; create `FUNDING.yml` [`d4d6d29`](https://github.com/ljharb/call-bind/commit/d4d6d2974a14bc2e98830468eda7fe6d6a776717)
|
|
91
|
-
- [Tests] add `npm run lint` [`dedfb98`](https://github.com/ljharb/call-bind/commit/dedfb98bd0ecefb08ddb9a94061bd10cde4332af)
|
|
92
|
-
- Only apps should have lockfiles [`54ac776`](https://github.com/ljharb/call-bind/commit/54ac77653db45a7361dc153d2f478e743f110650)
|
|
93
|
-
- [meta] add `safe-publish-latest` [`9ea8e43`](https://github.com/ljharb/call-bind/commit/9ea8e435b950ce9b705559cd651039f9bf40140f)
|
|
@@ -1,64 +0,0 @@
|
|
|
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
|
-
|
|
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
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var GetIntrinsic = require('get-intrinsic');
|
|
4
|
-
|
|
5
|
-
var callBind = require('./');
|
|
6
|
-
|
|
7
|
-
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
8
|
-
|
|
9
|
-
module.exports = function callBoundIntrinsic(name, allowMissing) {
|
|
10
|
-
var intrinsic = GetIntrinsic(name, !!allowMissing);
|
|
11
|
-
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
|
|
12
|
-
return callBind(intrinsic);
|
|
13
|
-
}
|
|
14
|
-
return intrinsic;
|
|
15
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var bind = require('function-bind');
|
|
4
|
-
var GetIntrinsic = require('get-intrinsic');
|
|
5
|
-
var setFunctionLength = require('set-function-length');
|
|
6
|
-
|
|
7
|
-
var $TypeError = require('es-errors/type');
|
|
8
|
-
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
9
|
-
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
10
|
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
|
|
11
|
-
|
|
12
|
-
var $defineProperty = require('es-define-property');
|
|
13
|
-
var $max = GetIntrinsic('%Math.max%');
|
|
14
|
-
|
|
15
|
-
module.exports = function callBind(originalFunction) {
|
|
16
|
-
if (typeof originalFunction !== 'function') {
|
|
17
|
-
throw new $TypeError('a function is required');
|
|
18
|
-
}
|
|
19
|
-
var func = $reflectApply(bind, $call, arguments);
|
|
20
|
-
return setFunctionLength(
|
|
21
|
-
func,
|
|
22
|
-
1 + $max(0, originalFunction.length - (arguments.length - 1)),
|
|
23
|
-
true
|
|
24
|
-
);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
var applyBind = function applyBind() {
|
|
28
|
-
return $reflectApply(bind, $apply, arguments);
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
if ($defineProperty) {
|
|
32
|
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
33
|
-
} else {
|
|
34
|
-
module.exports.apply = applyBind;
|
|
35
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var callBind = require('../');
|
|
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');
|
|
10
|
-
|
|
11
|
-
var test = require('tape');
|
|
12
|
-
|
|
13
|
-
/*
|
|
14
|
-
* older engines have length nonconfigurable
|
|
15
|
-
* in io.js v3, it is configurable except on bound functions, hence the .bind()
|
|
16
|
-
*/
|
|
17
|
-
var functionsHaveConfigurableLengths = !!(
|
|
18
|
-
gOPD
|
|
19
|
-
&& Object.getOwnPropertyDescriptor
|
|
20
|
-
&& Object.getOwnPropertyDescriptor(bind.call(function () {}), 'length').configurable
|
|
21
|
-
);
|
|
22
|
-
|
|
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
|
-
|
|
32
|
-
var sentinel = { sentinel: true };
|
|
33
|
-
var func = function (a, b) {
|
|
34
|
-
// eslint-disable-next-line no-invalid-this
|
|
35
|
-
return [!hasStrictMode && this === global ? undefined : this, a, b];
|
|
36
|
-
};
|
|
37
|
-
t.equal(func.length, 2, 'original function length is 2');
|
|
38
|
-
t.deepEqual(func(), [undefined, undefined, undefined], 'unbound func with too few args');
|
|
39
|
-
t.deepEqual(func(1, 2), [undefined, 1, 2], 'unbound func with right args');
|
|
40
|
-
t.deepEqual(func(1, 2, 3), [undefined, 1, 2], 'unbound func with too many args');
|
|
41
|
-
|
|
42
|
-
var bound = callBind(func);
|
|
43
|
-
t.equal(bound.length, func.length + 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
|
|
44
|
-
t.deepEqual(bound(), [undefined, undefined, undefined], 'bound func with too few 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');
|
|
47
|
-
|
|
48
|
-
var boundR = callBind(func, sentinel);
|
|
49
|
-
t.equal(boundR.length, func.length, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
|
|
50
|
-
t.deepEqual(boundR(), [sentinel, undefined, undefined], 'bound func with receiver, with too few args');
|
|
51
|
-
t.deepEqual(boundR(1, 2), [sentinel, 1, 2], 'bound func with receiver, with right args');
|
|
52
|
-
t.deepEqual(boundR(1, 2, 3), [sentinel, 1, 2], 'bound func with receiver, with too many args');
|
|
53
|
-
|
|
54
|
-
var boundArg = callBind(func, sentinel, 1);
|
|
55
|
-
t.equal(boundArg.length, func.length - 1, 'function length is preserved', { skip: !functionsHaveConfigurableLengths });
|
|
56
|
-
t.deepEqual(boundArg(), [sentinel, 1, undefined], 'bound func with receiver and arg, with too few args');
|
|
57
|
-
t.deepEqual(boundArg(2), [sentinel, 1, 2], 'bound func with receiver and arg, with right arg');
|
|
58
|
-
t.deepEqual(boundArg(2, 3), [sentinel, 1, 2], 'bound func with receiver and arg, with too many args');
|
|
59
|
-
|
|
60
|
-
t.test('callBind.apply', function (st) {
|
|
61
|
-
var aBound = callBind.apply(func);
|
|
62
|
-
st.deepEqual(aBound(sentinel), [sentinel, undefined, undefined], 'apply-bound func with no args');
|
|
63
|
-
st.deepEqual(aBound(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args');
|
|
64
|
-
st.deepEqual(aBound(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args');
|
|
65
|
-
|
|
66
|
-
var aBoundArg = callBind.apply(func);
|
|
67
|
-
st.deepEqual(aBoundArg(sentinel, [1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with too many args');
|
|
68
|
-
st.deepEqual(aBoundArg(sentinel, [1, 2], 4), [sentinel, 1, 2], 'apply-bound func with right args');
|
|
69
|
-
st.deepEqual(aBoundArg(sentinel, [1], 4), [sentinel, 1, undefined], 'apply-bound func with too few args');
|
|
70
|
-
|
|
71
|
-
var aBoundR = callBind.apply(func, sentinel);
|
|
72
|
-
st.deepEqual(aBoundR([1, 2, 3], 4), [sentinel, 1, 2], 'apply-bound func with receiver and too many args');
|
|
73
|
-
st.deepEqual(aBoundR([1, 2], 4), [sentinel, 1, 2], 'apply-bound func with receiver and right args');
|
|
74
|
-
st.deepEqual(aBoundR([1], 4), [sentinel, 1, undefined], 'apply-bound func with receiver and too few args');
|
|
75
|
-
|
|
76
|
-
st.end();
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
t.end();
|
|
80
|
-
});
|
|
@@ -1,24 +0,0 @@
|
|
|
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
|
-
}
|