node-red-contrib-web-worldmap 5.1.5 → 5.2.0
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 +6 -4
- package/README.md +6 -4
- 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 +1 -1
- package/worldmap/worldmap.js +29 -22
- package/worldmap.html +1 -0
- package/worldmap.js +5 -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
|
@@ -287,13 +287,16 @@ function quote(s) {
|
|
|
287
287
|
return $replace.call(String(s), /"/g, '"');
|
|
288
288
|
}
|
|
289
289
|
|
|
290
|
-
function
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
function
|
|
294
|
-
function
|
|
295
|
-
function
|
|
296
|
-
function
|
|
290
|
+
function canTrustToString(obj) {
|
|
291
|
+
return !toStringTag || !(typeof obj === 'object' && (toStringTag in obj || typeof obj[toStringTag] !== 'undefined'));
|
|
292
|
+
}
|
|
293
|
+
function isArray(obj) { return toStr(obj) === '[object Array]' && canTrustToString(obj); }
|
|
294
|
+
function isDate(obj) { return toStr(obj) === '[object Date]' && canTrustToString(obj); }
|
|
295
|
+
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && canTrustToString(obj); }
|
|
296
|
+
function isError(obj) { return toStr(obj) === '[object Error]' && canTrustToString(obj); }
|
|
297
|
+
function isString(obj) { return toStr(obj) === '[object String]' && canTrustToString(obj); }
|
|
298
|
+
function isNumber(obj) { return toStr(obj) === '[object Number]' && canTrustToString(obj); }
|
|
299
|
+
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && canTrustToString(obj); }
|
|
297
300
|
|
|
298
301
|
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
|
|
299
302
|
function isSymbol(obj) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-inspect",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.4",
|
|
4
4
|
"description": "string representations of objects in node and the browser",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -10,13 +10,13 @@
|
|
|
10
10
|
"auto-changelog": "^2.5.0",
|
|
11
11
|
"core-js": "^2.6.12",
|
|
12
12
|
"error-cause": "^1.0.8",
|
|
13
|
-
"es-value-fixtures": "^1.
|
|
13
|
+
"es-value-fixtures": "^1.7.1",
|
|
14
14
|
"eslint": "=8.8.0",
|
|
15
|
-
"for-each": "^0.3.
|
|
15
|
+
"for-each": "^0.3.4",
|
|
16
16
|
"functions-have-names": "^1.2.3",
|
|
17
17
|
"glob": "=10.3.7",
|
|
18
18
|
"globalthis": "^1.0.4",
|
|
19
|
-
"has-symbols": "^1.0
|
|
19
|
+
"has-symbols": "^1.1.0",
|
|
20
20
|
"has-tostringtag": "^1.0.2",
|
|
21
21
|
"in-publish": "^2.0.1",
|
|
22
22
|
"jackspeak": "=2.1.1",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"nyc": "^10.3.2",
|
|
27
27
|
"safe-publish-latest": "^2.0.0",
|
|
28
28
|
"safer-buffer": "^2.1.2",
|
|
29
|
+
"semver": "^6.3.1",
|
|
29
30
|
"string.prototype.repeat": "^1.0.0",
|
|
30
31
|
"tape": "^5.9.0"
|
|
31
32
|
},
|
|
@@ -5,6 +5,8 @@ var test = require('tape');
|
|
|
5
5
|
var mockProperty = require('mock-property');
|
|
6
6
|
var hasSymbols = require('has-symbols/shams')();
|
|
7
7
|
var hasToStringTag = require('has-tostringtag/shams')();
|
|
8
|
+
var forEach = require('for-each');
|
|
9
|
+
var semver = require('semver');
|
|
8
10
|
|
|
9
11
|
test('values', function (t) {
|
|
10
12
|
t.plan(1);
|
|
@@ -209,3 +211,51 @@ test('RegExps', function (t) {
|
|
|
209
211
|
|
|
210
212
|
t.end();
|
|
211
213
|
});
|
|
214
|
+
|
|
215
|
+
test('Proxies', { skip: typeof Proxy !== 'function' || !hasToStringTag }, function (t) {
|
|
216
|
+
var target = { proxy: true };
|
|
217
|
+
var fake = new Proxy(target, { has: function () { return false; } });
|
|
218
|
+
|
|
219
|
+
// needed to work around a weird difference in node v6.0 - v6.4 where non-present properties are not logged
|
|
220
|
+
var isNode60 = semver.satisfies(process.version, '6.0 - 6.4');
|
|
221
|
+
|
|
222
|
+
forEach([
|
|
223
|
+
'Boolean',
|
|
224
|
+
'Number',
|
|
225
|
+
'String',
|
|
226
|
+
'Symbol',
|
|
227
|
+
'Date'
|
|
228
|
+
], function (tag) {
|
|
229
|
+
target[Symbol.toStringTag] = tag;
|
|
230
|
+
|
|
231
|
+
t.equal(
|
|
232
|
+
inspect(fake),
|
|
233
|
+
'{ ' + (isNode60 ? '' : 'proxy: true, ') + '[Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
234
|
+
'Proxy for + ' + tag + ' shows as the target, which has no slots'
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
t.end();
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
test('fakers', { skip: !hasToStringTag }, function (t) {
|
|
242
|
+
var target = { proxy: false };
|
|
243
|
+
|
|
244
|
+
forEach([
|
|
245
|
+
'Boolean',
|
|
246
|
+
'Number',
|
|
247
|
+
'String',
|
|
248
|
+
'Symbol',
|
|
249
|
+
'Date'
|
|
250
|
+
], function (tag) {
|
|
251
|
+
target[Symbol.toStringTag] = tag;
|
|
252
|
+
|
|
253
|
+
t.equal(
|
|
254
|
+
inspect(target),
|
|
255
|
+
'{ proxy: false, [Symbol(Symbol.toStringTag)]: \'' + tag + '\' }',
|
|
256
|
+
'Object pretending to be ' + tag + ' does not trick us'
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
t.end();
|
|
261
|
+
});
|
|
@@ -5,6 +5,21 @@ 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.1.0](https://github.com/ljharb/side-channel/compare/v1.0.6...v1.1.0) - 2024-12-11
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [Refactor] extract implementations to `side-channel-weakmap`, `side-channel-map`, `side-channel-list` [`ada5955`](https://github.com/ljharb/side-channel/commit/ada595549a5c4c6c853756d598846b180941c6da)
|
|
13
|
+
- [New] add `channel.delete` [`c01d2d3`](https://github.com/ljharb/side-channel/commit/c01d2d3fd51dbb1ce6da72ad7916e61bd6172aad)
|
|
14
|
+
- [types] improve types [`0c54356`](https://github.com/ljharb/side-channel/commit/0c5435651417df41b8cc1a5f7cdce8bffae68cde)
|
|
15
|
+
- [readme] add content [`be24868`](https://github.com/ljharb/side-channel/commit/be248682ac294b0e22c883092c45985aa91c490a)
|
|
16
|
+
- [actions] split out node 10-20, and 20+ [`c4488e2`](https://github.com/ljharb/side-channel/commit/c4488e241ef3d49a19fe266ac830a2e644305911)
|
|
17
|
+
- [types] use shared tsconfig [`0e0d57c`](https://github.com/ljharb/side-channel/commit/0e0d57c2ff17c7b45c6cbd43ebcf553edc9e3adc)
|
|
18
|
+
- [Dev Deps] update `@ljharb/eslint-config`, `@ljharb/tsconfig`, `@types/get-intrinsic`, `@types/object-inspect`, `@types/tape`, `auto-changelog`, `tape` [`fb4f622`](https://github.com/ljharb/side-channel/commit/fb4f622e64a99a1e40b6e5cd7691674a9dc429e4)
|
|
19
|
+
- [Deps] update `call-bind`, `get-intrinsic`, `object-inspect` [`b78336b`](https://github.com/ljharb/side-channel/commit/b78336b886172d1b457d414ac9e28de8c5fecc78)
|
|
20
|
+
- [Tests] replace `aud` with `npm audit` [`ee3ab46`](https://github.com/ljharb/side-channel/commit/ee3ab4690d954311c35115651bcfd45edd205aa1)
|
|
21
|
+
- [Dev Deps] add missing peer dep [`c03e21a`](https://github.com/ljharb/side-channel/commit/c03e21a7def3b67cdc15ae22316884fefcb2f6a8)
|
|
22
|
+
|
|
8
23
|
## [v1.0.6](https://github.com/ljharb/side-channel/compare/v1.0.5...v1.0.6) - 2024-02-29
|
|
9
24
|
|
|
10
25
|
### Commits
|
|
@@ -1,2 +1,61 @@
|
|
|
1
|
-
# side-channel
|
|
1
|
+
# side-channel <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
|
+
|
|
2
10
|
Store information about any JS value in a side channel. Uses WeakMap if available.
|
|
11
|
+
|
|
12
|
+
Warning: in an environment that lacks `WeakMap`, this implementation will leak memory until you `delete` the `key`.
|
|
13
|
+
|
|
14
|
+
## Getting started
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
npm install --save side-channel
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Usage/Examples
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
const assert = require('assert');
|
|
24
|
+
const getSideChannel = require('side-channel');
|
|
25
|
+
|
|
26
|
+
const channel = getSideChannel();
|
|
27
|
+
|
|
28
|
+
const key = {};
|
|
29
|
+
assert.equal(channel.has(key), false);
|
|
30
|
+
assert.throws(() => channel.assert(key), TypeError);
|
|
31
|
+
|
|
32
|
+
channel.set(key, 42);
|
|
33
|
+
|
|
34
|
+
channel.assert(key); // does not throw
|
|
35
|
+
assert.equal(channel.has(key), true);
|
|
36
|
+
assert.equal(channel.get(key), 42);
|
|
37
|
+
|
|
38
|
+
channel.delete(key);
|
|
39
|
+
assert.equal(channel.has(key), false);
|
|
40
|
+
assert.throws(() => channel.assert(key), TypeError);
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Tests
|
|
44
|
+
|
|
45
|
+
Clone the repo, `npm install`, and run `npm test`
|
|
46
|
+
|
|
47
|
+
[package-url]: https://npmjs.org/package/side-channel
|
|
48
|
+
[npm-version-svg]: https://versionbadg.es/ljharb/side-channel.svg
|
|
49
|
+
[deps-svg]: https://david-dm.org/ljharb/side-channel.svg
|
|
50
|
+
[deps-url]: https://david-dm.org/ljharb/side-channel
|
|
51
|
+
[dev-deps-svg]: https://david-dm.org/ljharb/side-channel/dev-status.svg
|
|
52
|
+
[dev-deps-url]: https://david-dm.org/ljharb/side-channel#info=devDependencies
|
|
53
|
+
[npm-badge-png]: https://nodei.co/npm/side-channel.png?downloads=true&stars=true
|
|
54
|
+
[license-image]: https://img.shields.io/npm/l/side-channel.svg
|
|
55
|
+
[license-url]: LICENSE
|
|
56
|
+
[downloads-image]: https://img.shields.io/npm/dm/side-channel.svg
|
|
57
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=side-channel
|
|
58
|
+
[codecov-image]: https://codecov.io/gh/ljharb/side-channel/branch/main/graphs/badge.svg
|
|
59
|
+
[codecov-url]: https://app.codecov.io/gh/ljharb/side-channel/
|
|
60
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/ljharb/side-channel
|
|
61
|
+
[actions-url]: https://github.com/ljharb/side-channel/actions
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
key: Key;
|
|
5
|
-
next: ListNode<T>;
|
|
6
|
-
value: T;
|
|
7
|
-
};
|
|
8
|
-
type RootNode<T> = {
|
|
9
|
-
key: object;
|
|
10
|
-
next: null | ListNode<T>;
|
|
11
|
-
};
|
|
12
|
-
function listGetNode<T>(list: RootNode<T>, key: ListNode<T>['key']): ListNode<T> | void;
|
|
13
|
-
function listGet<T>(objects: RootNode<T>, key: ListNode<T>['key']): T | void;
|
|
14
|
-
function listSet<T>(objects: RootNode<T>, key: ListNode<T>['key'], value: T): void;
|
|
15
|
-
function listHas<T>(objects: RootNode<T>, key: ListNode<T>['key']): boolean;
|
|
1
|
+
import getSideChannelList from 'side-channel-list';
|
|
2
|
+
import getSideChannelMap from 'side-channel-map';
|
|
3
|
+
import getSideChannelWeakMap from 'side-channel-weakmap';
|
|
16
4
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}
|
|
5
|
+
declare namespace getSideChannel {
|
|
6
|
+
type Channel<K, V> =
|
|
7
|
+
| getSideChannelList.Channel<K, V>
|
|
8
|
+
| ReturnType<Exclude<typeof getSideChannelMap<K, V>, false>>
|
|
9
|
+
| ReturnType<Exclude<typeof getSideChannelWeakMap<K, V>, false>>;
|
|
23
10
|
}
|
|
24
11
|
|
|
25
|
-
declare function getSideChannel(): getSideChannel.Channel
|
|
12
|
+
declare function getSideChannel<K, V>(): getSideChannel.Channel<K, V>;
|
|
26
13
|
|
|
27
14
|
export = getSideChannel;
|
|
@@ -1,129 +1,43 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var GetIntrinsic = require('get-intrinsic');
|
|
4
|
-
var callBound = require('call-bind/callBound');
|
|
5
|
-
var inspect = require('object-inspect');
|
|
6
|
-
|
|
7
3
|
var $TypeError = require('es-errors/type');
|
|
8
|
-
var
|
|
9
|
-
var
|
|
10
|
-
|
|
11
|
-
var
|
|
12
|
-
var $weakMapSet = callBound('WeakMap.prototype.set', true);
|
|
13
|
-
var $weakMapHas = callBound('WeakMap.prototype.has', true);
|
|
14
|
-
var $mapGet = callBound('Map.prototype.get', true);
|
|
15
|
-
var $mapSet = callBound('Map.prototype.set', true);
|
|
16
|
-
var $mapHas = callBound('Map.prototype.has', true);
|
|
4
|
+
var inspect = require('object-inspect');
|
|
5
|
+
var getSideChannelList = require('side-channel-list');
|
|
6
|
+
var getSideChannelMap = require('side-channel-map');
|
|
7
|
+
var getSideChannelWeakMap = require('side-channel-weakmap');
|
|
17
8
|
|
|
18
|
-
|
|
19
|
-
* This function traverses the list returning the node corresponding to the given key.
|
|
20
|
-
*
|
|
21
|
-
* That node is also moved to the head of the list, so that if it's accessed again we don't need to traverse the whole list. By doing so, all the recently used nodes can be accessed relatively quickly.
|
|
22
|
-
*/
|
|
23
|
-
/** @type {import('.').listGetNode} */
|
|
24
|
-
var listGetNode = function (list, key) { // eslint-disable-line consistent-return
|
|
25
|
-
/** @type {typeof list | NonNullable<(typeof list)['next']>} */
|
|
26
|
-
var prev = list;
|
|
27
|
-
/** @type {(typeof list)['next']} */
|
|
28
|
-
var curr;
|
|
29
|
-
for (; (curr = prev.next) !== null; prev = curr) {
|
|
30
|
-
if (curr.key === key) {
|
|
31
|
-
prev.next = curr.next;
|
|
32
|
-
// eslint-disable-next-line no-extra-parens
|
|
33
|
-
curr.next = /** @type {NonNullable<typeof list.next>} */ (list.next);
|
|
34
|
-
list.next = curr; // eslint-disable-line no-param-reassign
|
|
35
|
-
return curr;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
/** @type {import('.').listGet} */
|
|
41
|
-
var listGet = function (objects, key) {
|
|
42
|
-
var node = listGetNode(objects, key);
|
|
43
|
-
return node && node.value;
|
|
44
|
-
};
|
|
45
|
-
/** @type {import('.').listSet} */
|
|
46
|
-
var listSet = function (objects, key, value) {
|
|
47
|
-
var node = listGetNode(objects, key);
|
|
48
|
-
if (node) {
|
|
49
|
-
node.value = value;
|
|
50
|
-
} else {
|
|
51
|
-
// Prepend the new node to the beginning of the list
|
|
52
|
-
objects.next = /** @type {import('.').ListNode<typeof value>} */ ({ // eslint-disable-line no-param-reassign, no-extra-parens
|
|
53
|
-
key: key,
|
|
54
|
-
next: objects.next,
|
|
55
|
-
value: value
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
};
|
|
59
|
-
/** @type {import('.').listHas} */
|
|
60
|
-
var listHas = function (objects, key) {
|
|
61
|
-
return !!listGetNode(objects, key);
|
|
62
|
-
};
|
|
9
|
+
var makeChannel = getSideChannelWeakMap || getSideChannelMap || getSideChannelList;
|
|
63
10
|
|
|
64
11
|
/** @type {import('.')} */
|
|
65
12
|
module.exports = function getSideChannel() {
|
|
66
|
-
/** @
|
|
67
|
-
/** @type {Map<object, unknown>} */ var $m;
|
|
68
|
-
/** @type {import('.').RootNode<unknown>} */ var $o;
|
|
13
|
+
/** @typedef {ReturnType<typeof getSideChannel>} Channel */
|
|
69
14
|
|
|
70
|
-
/** @type {
|
|
15
|
+
/** @type {Channel | undefined} */ var $channelData;
|
|
16
|
+
|
|
17
|
+
/** @type {Channel} */
|
|
71
18
|
var channel = {
|
|
72
19
|
assert: function (key) {
|
|
73
20
|
if (!channel.has(key)) {
|
|
74
21
|
throw new $TypeError('Side channel does not contain ' + inspect(key));
|
|
75
22
|
}
|
|
76
23
|
},
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
} else if ($Map) {
|
|
83
|
-
if ($m) {
|
|
84
|
-
return $mapGet($m, key);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
if ($o) { // eslint-disable-line no-lonely-if
|
|
88
|
-
return listGet($o, key);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
24
|
+
'delete': function (key) {
|
|
25
|
+
return !!$channelData && $channelData['delete'](key);
|
|
26
|
+
},
|
|
27
|
+
get: function (key) {
|
|
28
|
+
return $channelData && $channelData.get(key);
|
|
91
29
|
},
|
|
92
30
|
has: function (key) {
|
|
93
|
-
|
|
94
|
-
if ($wm) {
|
|
95
|
-
return $weakMapHas($wm, key);
|
|
96
|
-
}
|
|
97
|
-
} else if ($Map) {
|
|
98
|
-
if ($m) {
|
|
99
|
-
return $mapHas($m, key);
|
|
100
|
-
}
|
|
101
|
-
} else {
|
|
102
|
-
if ($o) { // eslint-disable-line no-lonely-if
|
|
103
|
-
return listHas($o, key);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
return false;
|
|
31
|
+
return !!$channelData && $channelData.has(key);
|
|
107
32
|
},
|
|
108
33
|
set: function (key, value) {
|
|
109
|
-
if (
|
|
110
|
-
|
|
111
|
-
$wm = new $WeakMap();
|
|
112
|
-
}
|
|
113
|
-
$weakMapSet($wm, key, value);
|
|
114
|
-
} else if ($Map) {
|
|
115
|
-
if (!$m) {
|
|
116
|
-
$m = new $Map();
|
|
117
|
-
}
|
|
118
|
-
$mapSet($m, key, value);
|
|
119
|
-
} else {
|
|
120
|
-
if (!$o) {
|
|
121
|
-
// Initialize the linked list as an empty node, so that we don't have to special-case handling of the first node: we can always refer to it as (previous node).next, instead of something like (list).head
|
|
122
|
-
$o = { key: {}, next: null };
|
|
123
|
-
}
|
|
124
|
-
listSet($o, key, value);
|
|
34
|
+
if (!$channelData) {
|
|
35
|
+
$channelData = makeChannel();
|
|
125
36
|
}
|
|
37
|
+
|
|
38
|
+
$channelData.set(key, value);
|
|
126
39
|
}
|
|
127
40
|
};
|
|
41
|
+
// @ts-expect-error TODO: figure out why this is erroring
|
|
128
42
|
return channel;
|
|
129
43
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "side-channel",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Store information about any JS value in a side channel. Uses WeakMap if available.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"exports": {
|
|
7
|
-
"
|
|
8
|
-
".": "./
|
|
7
|
+
".": "./index.js",
|
|
8
|
+
"./package.json": "./package.json"
|
|
9
9
|
},
|
|
10
10
|
"types": "./index.d.ts",
|
|
11
11
|
"scripts": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"prepublish": "not-in-publish || npm run prepublishOnly",
|
|
15
15
|
"prelint": "eclint check $(git ls-files | xargs find 2> /dev/null | grep -vE 'node_modules|\\.git')",
|
|
16
16
|
"lint": "eslint --ext=js,mjs .",
|
|
17
|
-
"postlint": "tsc -p .",
|
|
17
|
+
"postlint": "tsc -p . && attw -P",
|
|
18
18
|
"pretest": "npm run lint",
|
|
19
19
|
"tests-only": "nyc tape 'test/**/*.js'",
|
|
20
20
|
"test": "npm run tests-only",
|
|
21
|
-
"posttest": "
|
|
21
|
+
"posttest": "npx npm@'>=10.2' audit --production",
|
|
22
22
|
"version": "auto-changelog && git add CHANGELOG.md",
|
|
23
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
24
|
},
|
|
@@ -42,29 +42,30 @@
|
|
|
42
42
|
"url": "https://github.com/ljharb/side-channel/issues"
|
|
43
43
|
},
|
|
44
44
|
"homepage": "https://github.com/ljharb/side-channel#readme",
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"es-errors": "^1.3.0",
|
|
47
|
+
"object-inspect": "^1.13.3",
|
|
48
|
+
"side-channel-list": "^1.0.0",
|
|
49
|
+
"side-channel-map": "^1.0.1",
|
|
50
|
+
"side-channel-weakmap": "^1.0.2"
|
|
51
|
+
},
|
|
45
52
|
"devDependencies": {
|
|
46
|
-
"@
|
|
47
|
-
"@
|
|
48
|
-
"@
|
|
49
|
-
"@types/object-inspect": "^1.
|
|
50
|
-
"@types/tape": "^5.6.
|
|
51
|
-
"
|
|
52
|
-
"auto-changelog": "^2.4.0",
|
|
53
|
+
"@arethetypeswrong/cli": "^0.17.1",
|
|
54
|
+
"@ljharb/eslint-config": "^21.1.1",
|
|
55
|
+
"@ljharb/tsconfig": "^0.2.2",
|
|
56
|
+
"@types/object-inspect": "^1.13.0",
|
|
57
|
+
"@types/tape": "^5.6.5",
|
|
58
|
+
"auto-changelog": "^2.5.0",
|
|
53
59
|
"eclint": "^2.8.1",
|
|
60
|
+
"encoding": "^0.1.13",
|
|
54
61
|
"eslint": "=8.8.0",
|
|
55
62
|
"in-publish": "^2.0.1",
|
|
56
63
|
"npmignore": "^0.3.1",
|
|
57
64
|
"nyc": "^10.3.2",
|
|
58
65
|
"safe-publish-latest": "^2.0.0",
|
|
59
|
-
"tape": "^5.
|
|
66
|
+
"tape": "^5.9.0",
|
|
60
67
|
"typescript": "next"
|
|
61
68
|
},
|
|
62
|
-
"dependencies": {
|
|
63
|
-
"call-bind": "^1.0.7",
|
|
64
|
-
"es-errors": "^1.3.0",
|
|
65
|
-
"get-intrinsic": "^1.2.4",
|
|
66
|
-
"object-inspect": "^1.13.1"
|
|
67
|
-
},
|
|
68
69
|
"auto-changelog": {
|
|
69
70
|
"output": "CHANGELOG.md",
|
|
70
71
|
"template": "keepachangelog",
|
|
@@ -4,80 +4,101 @@ var test = require('tape');
|
|
|
4
4
|
|
|
5
5
|
var getSideChannel = require('../');
|
|
6
6
|
|
|
7
|
-
test('
|
|
8
|
-
t.
|
|
9
|
-
|
|
7
|
+
test('getSideChannel', function (t) {
|
|
8
|
+
t.test('export', function (st) {
|
|
9
|
+
st.equal(typeof getSideChannel, 'function', 'is a function');
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
t.ok(channel, 'is truthy');
|
|
13
|
-
t.equal(typeof channel, 'object', 'is an object');
|
|
11
|
+
st.equal(getSideChannel.length, 0, 'takes no arguments');
|
|
14
12
|
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
var channel = getSideChannel();
|
|
14
|
+
st.ok(channel, 'is truthy');
|
|
15
|
+
st.equal(typeof channel, 'object', 'is an object');
|
|
16
|
+
st.end();
|
|
17
|
+
});
|
|
17
18
|
|
|
18
|
-
test('assert', function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
19
|
+
t.test('assert', function (st) {
|
|
20
|
+
var channel = getSideChannel();
|
|
21
|
+
st['throws'](
|
|
22
|
+
function () { channel.assert({}); },
|
|
23
|
+
TypeError,
|
|
24
|
+
'nonexistent value throws'
|
|
25
|
+
);
|
|
25
26
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
var o = {};
|
|
28
|
+
channel.set(o, 'data');
|
|
29
|
+
st.doesNotThrow(function () { channel.assert(o); }, 'existent value noops');
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
});
|
|
31
|
+
st.end();
|
|
32
|
+
});
|
|
32
33
|
|
|
33
|
-
test('has', function (
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
t.test('has', function (st) {
|
|
35
|
+
var channel = getSideChannel();
|
|
36
|
+
/** @type {unknown[]} */ var o = [];
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
st.equal(channel.has(o), false, 'nonexistent value yields false');
|
|
38
39
|
|
|
39
|
-
|
|
40
|
-
|
|
40
|
+
channel.set(o, 'foo');
|
|
41
|
+
st.equal(channel.has(o), true, 'existent value yields true');
|
|
41
42
|
|
|
42
|
-
|
|
43
|
+
st.equal(channel.has('abc'), false, 'non object value non existent yields false');
|
|
43
44
|
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
channel.set('abc', 'foo');
|
|
46
|
+
st.equal(channel.has('abc'), true, 'non object value that exists yields true');
|
|
46
47
|
|
|
47
|
-
|
|
48
|
-
});
|
|
48
|
+
st.end();
|
|
49
|
+
});
|
|
49
50
|
|
|
50
|
-
test('get', function (
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
51
|
+
t.test('get', function (st) {
|
|
52
|
+
var channel = getSideChannel();
|
|
53
|
+
var o = {};
|
|
54
|
+
st.equal(channel.get(o), undefined, 'nonexistent value yields undefined');
|
|
54
55
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
var data = {};
|
|
57
|
+
channel.set(o, data);
|
|
58
|
+
st.equal(channel.get(o), data, '"get" yields data set by "set"');
|
|
58
59
|
|
|
59
|
-
|
|
60
|
-
});
|
|
60
|
+
st.end();
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
t.test('set', function (st) {
|
|
64
|
+
var channel = getSideChannel();
|
|
65
|
+
var o = function () {};
|
|
66
|
+
st.equal(channel.get(o), undefined, 'value not set');
|
|
67
|
+
|
|
68
|
+
channel.set(o, 42);
|
|
69
|
+
st.equal(channel.get(o), 42, 'value was set');
|
|
70
|
+
|
|
71
|
+
channel.set(o, Infinity);
|
|
72
|
+
st.equal(channel.get(o), Infinity, 'value was set again');
|
|
73
|
+
|
|
74
|
+
var o2 = {};
|
|
75
|
+
channel.set(o2, 17);
|
|
76
|
+
st.equal(channel.get(o), Infinity, 'o is not modified');
|
|
77
|
+
st.equal(channel.get(o2), 17, 'o2 is set');
|
|
78
|
+
|
|
79
|
+
channel.set(o, 14);
|
|
80
|
+
st.equal(channel.get(o), 14, 'o is modified');
|
|
81
|
+
st.equal(channel.get(o2), 17, 'o2 is not modified');
|
|
82
|
+
|
|
83
|
+
st.end();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
t.test('delete', function (st) {
|
|
87
|
+
var channel = getSideChannel();
|
|
88
|
+
var o = {};
|
|
89
|
+
st.equal(channel['delete']({}), false, 'nonexistent value yields false');
|
|
61
90
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
var o = function () {};
|
|
65
|
-
t.equal(channel.get(o), undefined, 'value not set');
|
|
91
|
+
channel.set(o, 42);
|
|
92
|
+
st.equal(channel.has(o), true, 'value is set');
|
|
66
93
|
|
|
67
|
-
|
|
68
|
-
t.equal(channel.get(o), 42, 'value was set');
|
|
94
|
+
st.equal(channel['delete']({}), false, 'nonexistent value still yields false');
|
|
69
95
|
|
|
70
|
-
|
|
71
|
-
t.equal(channel.get(o), Infinity, 'value was set again');
|
|
96
|
+
st.equal(channel['delete'](o), true, 'deleted value yields true');
|
|
72
97
|
|
|
73
|
-
|
|
74
|
-
channel.set(o2, 17);
|
|
75
|
-
t.equal(channel.get(o), Infinity, 'o is not modified');
|
|
76
|
-
t.equal(channel.get(o2), 17, 'o2 is set');
|
|
98
|
+
st.equal(channel.has(o), false, 'value is no longer set');
|
|
77
99
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
t.equal(channel.get(o2), 17, 'o2 is not modified');
|
|
100
|
+
st.end();
|
|
101
|
+
});
|
|
81
102
|
|
|
82
103
|
t.end();
|
|
83
104
|
});
|