node-red-contrib-tak-registration 0.11.1 → 0.11.5
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/node_modules/@types/node/LICENSE +0 -0
- package/node_modules/@types/node/README.md +4 -5
- package/node_modules/@types/node/assert/strict.d.ts +4 -4
- package/node_modules/@types/node/assert.d.ts +50 -26
- package/node_modules/@types/node/async_hooks.d.ts +13 -6
- package/node_modules/@types/node/buffer.d.ts +46 -38
- package/node_modules/@types/node/child_process.d.ts +278 -138
- package/node_modules/@types/node/cluster.d.ts +107 -89
- package/node_modules/@types/node/console.d.ts +18 -15
- package/node_modules/@types/node/constants.d.ts +12 -11
- package/node_modules/@types/node/crypto.d.ts +746 -268
- package/node_modules/@types/node/dgram.d.ts +82 -46
- package/node_modules/@types/node/diagnostics_channel.d.ts +3 -3
- package/node_modules/@types/node/dns/promises.d.ts +37 -26
- package/node_modules/@types/node/dns.d.ts +204 -63
- package/node_modules/@types/node/dom-events.d.ts +67 -71
- package/node_modules/@types/node/domain.d.ts +4 -4
- package/node_modules/@types/node/events.d.ts +99 -8
- package/node_modules/@types/node/fs/promises.d.ts +122 -85
- package/node_modules/@types/node/fs.d.ts +520 -316
- package/node_modules/@types/node/globals.d.ts +346 -286
- package/node_modules/@types/node/globals.global.d.ts +0 -0
- package/node_modules/@types/node/http.d.ts +321 -189
- package/node_modules/@types/node/http2.d.ts +630 -377
- package/node_modules/@types/node/https.d.ts +221 -112
- package/node_modules/@types/node/index.d.ts +0 -45
- package/node_modules/@types/node/inspector.d.ts +0 -1
- package/node_modules/@types/node/module.d.ts +75 -31
- package/node_modules/@types/node/net.d.ts +149 -93
- package/node_modules/@types/node/os.d.ts +10 -9
- package/node_modules/@types/node/package.json +88 -90
- package/node_modules/@types/node/path.d.ts +13 -13
- package/node_modules/@types/node/perf_hooks.d.ts +19 -18
- package/node_modules/@types/node/process.d.ts +170 -126
- package/node_modules/@types/node/punycode.d.ts +4 -4
- package/node_modules/@types/node/querystring.d.ts +14 -4
- package/node_modules/@types/node/readline/promises.d.ts +12 -7
- package/node_modules/@types/node/readline.d.ts +69 -56
- package/node_modules/@types/node/repl.d.ts +67 -61
- package/node_modules/@types/node/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/stream/promises.d.ts +56 -15
- package/node_modules/@types/node/stream/web.d.ts +40 -20
- package/node_modules/@types/node/stream.d.ts +365 -232
- package/node_modules/@types/node/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/test.d.ts +133 -212
- package/node_modules/@types/node/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/timers.d.ts +26 -11
- package/node_modules/@types/node/tls.d.ts +152 -72
- package/node_modules/@types/node/trace_events.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/assert/strict.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/assert.d.ts +50 -26
- package/node_modules/@types/node/ts4.8/async_hooks.d.ts +13 -6
- package/node_modules/@types/node/ts4.8/buffer.d.ts +47 -39
- package/node_modules/@types/node/ts4.8/child_process.d.ts +278 -138
- package/node_modules/@types/node/ts4.8/cluster.d.ts +107 -89
- package/node_modules/@types/node/ts4.8/console.d.ts +18 -15
- package/node_modules/@types/node/ts4.8/constants.d.ts +12 -11
- package/node_modules/@types/node/ts4.8/crypto.d.ts +746 -268
- package/node_modules/@types/node/ts4.8/dgram.d.ts +82 -46
- package/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/dns/promises.d.ts +37 -26
- package/node_modules/@types/node/ts4.8/dns.d.ts +204 -63
- package/node_modules/@types/node/ts4.8/dom-events.d.ts +67 -71
- package/node_modules/@types/node/ts4.8/domain.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/events.d.ts +99 -8
- package/node_modules/@types/node/ts4.8/fs/promises.d.ts +122 -85
- package/node_modules/@types/node/ts4.8/fs.d.ts +520 -316
- package/node_modules/@types/node/ts4.8/globals.d.ts +346 -286
- package/node_modules/@types/node/ts4.8/globals.global.d.ts +0 -0
- package/node_modules/@types/node/ts4.8/http.d.ts +321 -189
- package/node_modules/@types/node/ts4.8/http2.d.ts +630 -377
- package/node_modules/@types/node/ts4.8/https.d.ts +221 -112
- package/node_modules/@types/node/ts4.8/index.d.ts +0 -0
- package/node_modules/@types/node/ts4.8/inspector.d.ts +0 -1
- package/node_modules/@types/node/ts4.8/module.d.ts +75 -31
- package/node_modules/@types/node/ts4.8/net.d.ts +149 -93
- package/node_modules/@types/node/ts4.8/os.d.ts +10 -9
- package/node_modules/@types/node/ts4.8/path.d.ts +13 -13
- package/node_modules/@types/node/ts4.8/perf_hooks.d.ts +19 -18
- package/node_modules/@types/node/ts4.8/process.d.ts +170 -126
- package/node_modules/@types/node/ts4.8/punycode.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/querystring.d.ts +14 -4
- package/node_modules/@types/node/ts4.8/readline/promises.d.ts +12 -7
- package/node_modules/@types/node/ts4.8/readline.d.ts +69 -56
- package/node_modules/@types/node/ts4.8/repl.d.ts +67 -61
- package/node_modules/@types/node/ts4.8/stream/consumers.d.ts +10 -10
- package/node_modules/@types/node/ts4.8/stream/promises.d.ts +56 -15
- package/node_modules/@types/node/ts4.8/stream/web.d.ts +40 -20
- package/node_modules/@types/node/ts4.8/stream.d.ts +494 -223
- package/node_modules/@types/node/ts4.8/string_decoder.d.ts +8 -8
- package/node_modules/@types/node/ts4.8/test.d.ts +135 -214
- package/node_modules/@types/node/ts4.8/timers/promises.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/timers.d.ts +26 -11
- package/node_modules/@types/node/ts4.8/tls.d.ts +152 -72
- package/node_modules/@types/node/ts4.8/trace_events.d.ts +3 -3
- package/node_modules/@types/node/ts4.8/tty.d.ts +10 -10
- package/node_modules/@types/node/ts4.8/url.d.ts +26 -14
- package/node_modules/@types/node/ts4.8/util.d.ts +187 -120
- package/node_modules/@types/node/ts4.8/v8.d.ts +4 -4
- package/node_modules/@types/node/ts4.8/vm.d.ts +58 -50
- package/node_modules/@types/node/ts4.8/wasi.d.ts +10 -4
- package/node_modules/@types/node/ts4.8/worker_threads.d.ts +83 -86
- package/node_modules/@types/node/ts4.8/zlib.d.ts +9 -9
- package/node_modules/@types/node/tty.d.ts +10 -10
- package/node_modules/@types/node/url.d.ts +26 -14
- package/node_modules/@types/node/util.d.ts +187 -120
- package/node_modules/@types/node/v8.d.ts +4 -4
- package/node_modules/@types/node/vm.d.ts +58 -50
- package/node_modules/@types/node/wasi.d.ts +10 -4
- package/node_modules/@types/node/worker_threads.d.ts +83 -86
- package/node_modules/@types/node/zlib.d.ts +9 -9
- package/node_modules/axios/CHANGELOG.md +225 -0
- package/node_modules/axios/README.md +273 -9
- package/node_modules/axios/dist/axios.js +249 -178
- package/node_modules/axios/dist/axios.js.map +1 -1
- package/node_modules/axios/dist/axios.min.js +1 -1
- package/node_modules/axios/dist/axios.min.js.map +1 -1
- package/node_modules/axios/dist/browser/axios.cjs +213 -193
- package/node_modules/axios/dist/browser/axios.cjs.map +1 -1
- package/node_modules/axios/dist/esm/axios.js +213 -193
- package/node_modules/axios/dist/esm/axios.js.map +1 -1
- package/node_modules/axios/dist/esm/axios.min.js +1 -1
- package/node_modules/axios/dist/esm/axios.min.js.map +1 -1
- package/node_modules/axios/dist/node/axios.cjs +297 -213
- package/node_modules/axios/dist/node/axios.cjs.map +1 -1
- package/node_modules/axios/index.d.cts +20 -11
- package/node_modules/axios/index.d.ts +21 -12
- package/node_modules/axios/lib/adapters/adapters.js +33 -15
- package/node_modules/axios/lib/adapters/http.js +25 -12
- package/node_modules/axios/lib/adapters/xhr.js +17 -10
- package/node_modules/axios/lib/core/mergeConfig.js +1 -0
- package/node_modules/axios/lib/defaults/index.js +1 -1
- package/node_modules/axios/lib/env/data.js +1 -1
- package/node_modules/axios/lib/helpers/cookies.js +39 -49
- package/node_modules/axios/lib/helpers/isURLSameOrigin.js +2 -2
- package/node_modules/axios/lib/platform/browser/index.js +0 -51
- package/node_modules/axios/lib/platform/common/utils.js +47 -0
- package/node_modules/axios/lib/platform/index.js +5 -1
- package/node_modules/axios/package.json +2 -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/{function-bind → deep-equal}/.editorconfig +1 -1
- package/node_modules/deep-equal/.eslintrc +6 -0
- package/node_modules/deep-equal/.nycrc +17 -0
- package/node_modules/deep-equal/CHANGELOG.md +204 -4
- package/node_modules/deep-equal/assert.js +3 -0
- package/node_modules/deep-equal/package.json +39 -17
- package/node_modules/deep-equal/readme.markdown +28 -12
- package/node_modules/deep-equal/test/_tape.js +24 -3
- package/node_modules/deep-equal/test/cmp.js +1047 -48
- package/node_modules/define-data-property/CHANGELOG.md +10 -0
- package/node_modules/define-data-property/index.d.ts.map +1 -1
- package/node_modules/define-data-property/index.js +8 -0
- package/node_modules/define-data-property/package.json +11 -9
- package/node_modules/define-data-property/test/index.js +6 -11
- package/node_modules/define-data-property/tsconfig.json +1 -0
- package/node_modules/fast-xml-parser/CHANGELOG.md +11 -0
- package/node_modules/fast-xml-parser/package.json +5 -5
- package/node_modules/fast-xml-parser/src/xmlbuilder/json2xml.js +1 -0
- package/node_modules/fast-xml-parser/src/xmlbuilder/orderedJs2Xml.js +4 -0
- package/node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js +6 -3
- package/node_modules/follow-redirects/index.js +16 -4
- package/node_modules/follow-redirects/package.json +2 -3
- package/node_modules/function-bind/.eslintrc +11 -5
- package/node_modules/function-bind/.github/FUNDING.yml +12 -0
- package/node_modules/function-bind/.github/SECURITY.md +3 -0
- package/node_modules/function-bind/.nycrc +13 -0
- package/node_modules/function-bind/CHANGELOG.md +136 -0
- package/node_modules/function-bind/README.md +25 -27
- package/node_modules/function-bind/implementation.js +44 -12
- package/node_modules/function-bind/package.json +38 -14
- package/node_modules/get-intrinsic/CHANGELOG.md +8 -0
- package/node_modules/get-intrinsic/index.js +1 -1
- package/node_modules/get-intrinsic/package.json +11 -11
- package/node_modules/has-property-descriptors/CHANGELOG.md +11 -0
- package/node_modules/has-property-descriptors/package.json +13 -6
- package/node_modules/hasown/.eslintrc +5 -0
- package/node_modules/hasown/.github/FUNDING.yml +12 -0
- package/node_modules/hasown/.nycrc +13 -0
- package/node_modules/hasown/CHANGELOG.md +20 -0
- package/node_modules/hasown/LICENSE +21 -0
- package/node_modules/hasown/README.md +40 -0
- package/node_modules/hasown/index.d.ts +3 -0
- package/node_modules/hasown/index.d.ts.map +1 -0
- package/node_modules/hasown/index.js +8 -0
- package/node_modules/hasown/package.json +91 -0
- package/node_modules/hasown/tsconfig.json +49 -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/undici-types/README.md +6 -0
- package/node_modules/undici-types/agent.d.ts +31 -0
- package/node_modules/undici-types/api.d.ts +43 -0
- package/node_modules/undici-types/balanced-pool.d.ts +18 -0
- package/node_modules/undici-types/cache.d.ts +36 -0
- package/node_modules/undici-types/client.d.ts +97 -0
- package/node_modules/undici-types/connector.d.ts +34 -0
- package/node_modules/undici-types/content-type.d.ts +21 -0
- package/node_modules/undici-types/cookies.d.ts +28 -0
- package/node_modules/undici-types/diagnostics-channel.d.ts +67 -0
- package/node_modules/undici-types/dispatcher.d.ts +241 -0
- package/node_modules/undici-types/errors.d.ts +128 -0
- package/node_modules/undici-types/fetch.d.ts +209 -0
- package/node_modules/undici-types/file.d.ts +39 -0
- package/node_modules/undici-types/filereader.d.ts +54 -0
- package/node_modules/undici-types/formdata.d.ts +108 -0
- package/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/node_modules/undici-types/global-origin.d.ts +7 -0
- package/node_modules/undici-types/handlers.d.ts +9 -0
- package/node_modules/undici-types/header.d.ts +4 -0
- package/node_modules/undici-types/index.d.ts +63 -0
- package/node_modules/undici-types/interceptors.d.ts +5 -0
- package/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/node_modules/undici-types/mock-client.d.ts +25 -0
- package/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/node_modules/undici-types/package.json +55 -0
- package/node_modules/undici-types/patch.d.ts +71 -0
- package/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/node_modules/undici-types/pool.d.ts +28 -0
- package/node_modules/undici-types/proxy-agent.d.ts +30 -0
- package/node_modules/undici-types/readable.d.ts +61 -0
- package/node_modules/undici-types/webidl.d.ts +220 -0
- package/node_modules/undici-types/websocket.d.ts +131 -0
- package/package.json +3 -3
- package/tak-ingest.js +42 -23
- package/tak-registration.html +4 -4
- package/node_modules/define-data-property/tsinit +0 -109
- package/node_modules/function-bind/.jscs.json +0 -176
- package/node_modules/function-bind/.npmignore +0 -22
- package/node_modules/function-bind/.travis.yml +0 -168
- package/node_modules/has/LICENSE-MIT +0 -22
- package/node_modules/has/README.md +0 -18
- package/node_modules/has/package.json +0 -48
- package/node_modules/has/src/index.js +0 -5
- package/node_modules/has/test/index.js +0 -10
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
1
3
|
var test = require('tape');
|
|
2
4
|
require('./_tape');
|
|
5
|
+
var assign = require('object.assign');
|
|
6
|
+
var gOPDs = require('object.getownpropertydescriptors');
|
|
7
|
+
var hasSymbols = require('has-symbols')();
|
|
8
|
+
var hasTypedArrays = require('has-typed-arrays')();
|
|
9
|
+
var semver = require('semver');
|
|
10
|
+
var keys = require('object-keys');
|
|
11
|
+
var availableTypedArrays = require('available-typed-arrays')();
|
|
12
|
+
var forEach = require('for-each');
|
|
13
|
+
var hasProto = require('has-proto')();
|
|
14
|
+
var defineDataProperty = require('define-data-property');
|
|
15
|
+
|
|
16
|
+
var safeBuffer = typeof Buffer === 'function' ? Buffer.from && Buffer.from.length > 1 ? Buffer.from : Buffer : null;
|
|
17
|
+
var buffersAreTypedArrays = typeof Buffer === 'function' && new Buffer(0) instanceof Uint8Array;
|
|
3
18
|
|
|
4
|
-
var
|
|
19
|
+
var isNode = typeof process === 'object' && typeof process.version === 'string';
|
|
20
|
+
|
|
21
|
+
function tag(obj, value) {
|
|
22
|
+
if (hasSymbols && Symbol.toStringTag && Object.defineProperty) {
|
|
23
|
+
Object.defineProperty(obj, Symbol.toStringTag, {
|
|
24
|
+
value: value
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return obj;
|
|
28
|
+
}
|
|
5
29
|
|
|
6
30
|
test('equal', function (t) {
|
|
7
31
|
t.deepEqualTest(
|
|
@@ -12,6 +36,298 @@ test('equal', function (t) {
|
|
|
12
36
|
true,
|
|
13
37
|
false
|
|
14
38
|
);
|
|
39
|
+
|
|
40
|
+
var obj1 = { a: [2, 3], b: [4] };
|
|
41
|
+
var obj2 = { b: [4], a: [2, 3] };
|
|
42
|
+
t.notDeepEqual(keys(obj1), keys(obj2), 'keys are in a different order');
|
|
43
|
+
t.deepEqual(keys(obj1), keys(obj2).reverse(), 'keys are in opposite order');
|
|
44
|
+
t.deepEqualTest(
|
|
45
|
+
obj1,
|
|
46
|
+
obj2,
|
|
47
|
+
'two equal objects, in different order',
|
|
48
|
+
true,
|
|
49
|
+
true
|
|
50
|
+
);
|
|
51
|
+
|
|
52
|
+
t.deepEqualTest(
|
|
53
|
+
{ a: 2, b: '4' },
|
|
54
|
+
{ a: 2, b: 4 },
|
|
55
|
+
'two loosely equal, strictly inequal objects',
|
|
56
|
+
true,
|
|
57
|
+
false
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
t.deepEqualTest(
|
|
61
|
+
{ a: 2, b: 4 },
|
|
62
|
+
{ a: 2, B: 4 },
|
|
63
|
+
'two inequal objects',
|
|
64
|
+
false,
|
|
65
|
+
false
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
t.deepEqualTest(
|
|
69
|
+
'-000',
|
|
70
|
+
false,
|
|
71
|
+
'`false` and `"-000"`',
|
|
72
|
+
true,
|
|
73
|
+
false
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
t.end();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test('Maps', { skip: typeof Map !== 'function' }, function (t) {
|
|
80
|
+
t.deepEqualTest(
|
|
81
|
+
new Map([['a', 1], ['b', 2]]),
|
|
82
|
+
new Map([['b', 2], ['a', 1]]),
|
|
83
|
+
'two equal Maps',
|
|
84
|
+
true,
|
|
85
|
+
true
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
t.deepEqualTest(
|
|
89
|
+
new Map([['a', [1, 2]]]),
|
|
90
|
+
new Map([['a', [2, 1]]]),
|
|
91
|
+
'two Maps with inequal values on the same key',
|
|
92
|
+
true,
|
|
93
|
+
true
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
t.deepEqualTest(
|
|
97
|
+
new Map([['a', 1]]),
|
|
98
|
+
new Map([['b', 1]]),
|
|
99
|
+
'two inequal Maps',
|
|
100
|
+
true,
|
|
101
|
+
true
|
|
102
|
+
);
|
|
103
|
+
|
|
104
|
+
t.deepEqualTest(
|
|
105
|
+
new Map([[{}, 3], [{}, 2], [{}, 1]]),
|
|
106
|
+
new Map([[{}, 1], [{}, 2], [{}, 3]]),
|
|
107
|
+
'two equal Maps in different orders with object keys',
|
|
108
|
+
true,
|
|
109
|
+
true
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
t.deepEqualTest(
|
|
113
|
+
new Map([[undefined, undefined]]),
|
|
114
|
+
new Map([[undefined, null]]),
|
|
115
|
+
'undefined keys, nullish values, loosely equal, strictly inequal',
|
|
116
|
+
true,
|
|
117
|
+
true
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
t.deepEqualTest(
|
|
121
|
+
new Map([[{}, null], [true, 2], [{}, 1], [undefined, {}]]),
|
|
122
|
+
new Map([[{}, 1], [true, 2], [{}, null], [undefined, {}]]),
|
|
123
|
+
'two equal Maps in different orders with primitive keys',
|
|
124
|
+
true,
|
|
125
|
+
true
|
|
126
|
+
);
|
|
127
|
+
|
|
128
|
+
t.deepEqualTest(
|
|
129
|
+
new Map([[false, 3], [{}, 2], [{}, 1]]),
|
|
130
|
+
new Map([[{}, 1], [{}, 2], [false, 3]]),
|
|
131
|
+
'two equal Maps in different orders with a mix of keys',
|
|
132
|
+
true,
|
|
133
|
+
true
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
t.deepEqualTest(
|
|
137
|
+
new Map([[null, undefined]]),
|
|
138
|
+
new Map([[null, null]]),
|
|
139
|
+
'null keys, nullish values, loosely equal, strictly inequal',
|
|
140
|
+
true,
|
|
141
|
+
true
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
t.deepEqualTest(
|
|
145
|
+
new Map([[undefined, 3]]),
|
|
146
|
+
new Map([[null, 3]]),
|
|
147
|
+
'nullish keys, loosely equal, strictly inequal',
|
|
148
|
+
true,
|
|
149
|
+
true
|
|
150
|
+
);
|
|
151
|
+
|
|
152
|
+
t.deepEqualTest(
|
|
153
|
+
new Map([[{}, null], [true, 2], [{}, 1], [undefined, {}]]),
|
|
154
|
+
new Map([[{}, 1], [true, 2], [{}, null], [undefined, {}]]),
|
|
155
|
+
'two equal Maps in different orders with primitive keys',
|
|
156
|
+
true,
|
|
157
|
+
true
|
|
158
|
+
);
|
|
159
|
+
|
|
160
|
+
t.deepEqualTest(
|
|
161
|
+
new Map([[false, 3], [{}, 2], [{}, 1]]),
|
|
162
|
+
new Map([[{}, 1], [{}, 2], [false, 3]]),
|
|
163
|
+
'two equal Maps in different orders with a mix of keys',
|
|
164
|
+
true,
|
|
165
|
+
true
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
t.deepEqualTest(
|
|
169
|
+
new Map(),
|
|
170
|
+
new Map([[{}, 1]]),
|
|
171
|
+
'two inequal Maps',
|
|
172
|
+
true,
|
|
173
|
+
true
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
t.deepEqualTest(
|
|
177
|
+
new Map([[{}, null], [false, 3]]),
|
|
178
|
+
new Map([[{}, null], [true, 2]]),
|
|
179
|
+
'two inequal maps, same size, primitive key, start with object key',
|
|
180
|
+
true,
|
|
181
|
+
true
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
t.deepEqualTest(
|
|
185
|
+
new Map([[false, 3], [{}, null]]),
|
|
186
|
+
new Map([[true, 2], [{}, null]]),
|
|
187
|
+
'two inequal maps, same size, primitive key, start with primitive key',
|
|
188
|
+
true,
|
|
189
|
+
true
|
|
190
|
+
);
|
|
191
|
+
|
|
192
|
+
t.deepEqualTest(
|
|
193
|
+
new Map([[undefined, null], ['+000', 2]]),
|
|
194
|
+
new Map([[null, undefined], [false, '2']]),
|
|
195
|
+
'primitive comparisons',
|
|
196
|
+
true,
|
|
197
|
+
true
|
|
198
|
+
);
|
|
199
|
+
|
|
200
|
+
t.end();
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
test('WeakMaps', { skip: typeof WeakMap !== 'function' }, function (t) {
|
|
204
|
+
t.deepEqualTest(
|
|
205
|
+
new WeakMap([[Object, null], [Function, true]]),
|
|
206
|
+
new WeakMap([[Function, true], [Object, null]]),
|
|
207
|
+
'two equal WeakMaps',
|
|
208
|
+
true,
|
|
209
|
+
true
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
t.deepEqualTest(
|
|
213
|
+
new WeakMap([[Object, null]]),
|
|
214
|
+
new WeakMap([[Object, true]]),
|
|
215
|
+
'two WeakMaps with inequal values on the same key',
|
|
216
|
+
true,
|
|
217
|
+
true
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
t.deepEqualTest(
|
|
221
|
+
new WeakMap([[Object, null], [Function, true]]),
|
|
222
|
+
new WeakMap([[Object, null]]),
|
|
223
|
+
'two inequal WeakMaps',
|
|
224
|
+
true,
|
|
225
|
+
true
|
|
226
|
+
);
|
|
227
|
+
|
|
228
|
+
t.end();
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
test('Sets', { skip: typeof Set !== 'function' }, function (t) {
|
|
232
|
+
t.deepEqualTest(
|
|
233
|
+
new Set(['a', 1, 'b', 2]),
|
|
234
|
+
new Set(['b', 2, 'a', 1]),
|
|
235
|
+
'two equal Sets',
|
|
236
|
+
true,
|
|
237
|
+
true
|
|
238
|
+
);
|
|
239
|
+
|
|
240
|
+
t.deepEqualTest(
|
|
241
|
+
new Set(['a', 1]),
|
|
242
|
+
new Set(['b', 1]),
|
|
243
|
+
'two inequal Sets',
|
|
244
|
+
true,
|
|
245
|
+
true
|
|
246
|
+
);
|
|
247
|
+
|
|
248
|
+
t.deepEqualTest(
|
|
249
|
+
new Set([{}, 1, {}, {}, 2]),
|
|
250
|
+
new Set([{}, 1, {}, 2, {}]),
|
|
251
|
+
'two equal Sets in different orders',
|
|
252
|
+
true,
|
|
253
|
+
true
|
|
254
|
+
);
|
|
255
|
+
|
|
256
|
+
t.deepEqualTest(
|
|
257
|
+
new Set(),
|
|
258
|
+
new Set([1]),
|
|
259
|
+
'two inequally sized Sets',
|
|
260
|
+
true,
|
|
261
|
+
true
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
t.deepEqualTest(
|
|
265
|
+
new Set([{ a: 1 }, 2]),
|
|
266
|
+
new Set(['2', { a: '1' }]),
|
|
267
|
+
'two loosely equal, strictly inequal Sets',
|
|
268
|
+
true,
|
|
269
|
+
true
|
|
270
|
+
);
|
|
271
|
+
|
|
272
|
+
t.deepEqualTest(
|
|
273
|
+
new Set([{ a: 1 }, 2]),
|
|
274
|
+
new Set(['2', { a: 2 }]),
|
|
275
|
+
'two inequal Sets',
|
|
276
|
+
true,
|
|
277
|
+
true
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
t.deepEqualTest(
|
|
281
|
+
new Set([null, '', 1, 5, 2, false]),
|
|
282
|
+
new Set([undefined, 0, '5', true, '2', '-000']),
|
|
283
|
+
'more primitive comparisons',
|
|
284
|
+
true,
|
|
285
|
+
true
|
|
286
|
+
);
|
|
287
|
+
|
|
288
|
+
t.end();
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
test('Set and Map', { skip: !Object.defineProperty || typeof Set !== 'function' || typeof Map !== 'function' }, function (t) {
|
|
292
|
+
t.deepEqualTest(
|
|
293
|
+
new Set(),
|
|
294
|
+
new Map(),
|
|
295
|
+
'Map and Set',
|
|
296
|
+
true,
|
|
297
|
+
true
|
|
298
|
+
);
|
|
299
|
+
|
|
300
|
+
var maplikeSet = new Set();
|
|
301
|
+
Object.defineProperty(maplikeSet, 'constructor', { enumerable: false, value: Map });
|
|
302
|
+
maplikeSet.__proto__ = Map.prototype; // eslint-disable-line no-proto
|
|
303
|
+
t.deepEqualTest(
|
|
304
|
+
maplikeSet,
|
|
305
|
+
new Map(),
|
|
306
|
+
'Map-like Set, and Map',
|
|
307
|
+
true,
|
|
308
|
+
true
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
t.end();
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test('WeakSets', { skip: typeof WeakSet !== 'function' }, function (t) {
|
|
315
|
+
t.deepEqualTest(
|
|
316
|
+
new WeakSet([Object, Function]),
|
|
317
|
+
new WeakSet([Function, Object]),
|
|
318
|
+
'two equal WeakSets',
|
|
319
|
+
true,
|
|
320
|
+
true
|
|
321
|
+
);
|
|
322
|
+
|
|
323
|
+
t.deepEqualTest(
|
|
324
|
+
new WeakSet([Object, Function]),
|
|
325
|
+
new WeakSet([Object]),
|
|
326
|
+
'two inequal WeakSets',
|
|
327
|
+
true,
|
|
328
|
+
true
|
|
329
|
+
);
|
|
330
|
+
|
|
15
331
|
t.end();
|
|
16
332
|
});
|
|
17
333
|
|
|
@@ -23,6 +339,7 @@ test('not equal', function (t) {
|
|
|
23
339
|
false,
|
|
24
340
|
false
|
|
25
341
|
);
|
|
342
|
+
|
|
26
343
|
t.end();
|
|
27
344
|
});
|
|
28
345
|
|
|
@@ -71,9 +388,14 @@ test('arguments class', function (t) {
|
|
|
71
388
|
function getArgs() {
|
|
72
389
|
return arguments;
|
|
73
390
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
391
|
+
|
|
392
|
+
t.deepEqualTest(
|
|
393
|
+
getArgs(1, 2, 3),
|
|
394
|
+
getArgs(1, 2, 3),
|
|
395
|
+
'equivalent arguments objects are equal',
|
|
396
|
+
true,
|
|
397
|
+
true,
|
|
398
|
+
true
|
|
77
399
|
);
|
|
78
400
|
|
|
79
401
|
t.deepEqualTest(
|
|
@@ -84,37 +406,213 @@ test('arguments class', function (t) {
|
|
|
84
406
|
false
|
|
85
407
|
);
|
|
86
408
|
|
|
409
|
+
var args = getArgs();
|
|
410
|
+
var notArgs = tag({ length: 0 }, 'Arguments');
|
|
411
|
+
t.deepEqualTest(
|
|
412
|
+
args,
|
|
413
|
+
notArgs,
|
|
414
|
+
'args and similar arraylike object',
|
|
415
|
+
false,
|
|
416
|
+
false
|
|
417
|
+
);
|
|
418
|
+
|
|
87
419
|
t.end();
|
|
88
420
|
});
|
|
89
421
|
|
|
90
|
-
test('
|
|
422
|
+
test('Dates', function (t) {
|
|
91
423
|
var d0 = new Date(1387585278000);
|
|
92
424
|
var d1 = new Date('Fri Dec 20 2013 16:21:18 GMT-0800 (PST)');
|
|
93
|
-
|
|
425
|
+
|
|
426
|
+
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp', true, true);
|
|
427
|
+
|
|
428
|
+
d1.a = true;
|
|
429
|
+
|
|
430
|
+
t.deepEqualTest(d0, d1, 'two Dates with the same timestamp but different own properties', true, true);
|
|
431
|
+
|
|
432
|
+
t.test('overriding `getTime`', { skip: !Object.defineProperty }, function (st) {
|
|
433
|
+
var a = new Date('2000');
|
|
434
|
+
var b = new Date('2000');
|
|
435
|
+
Object.defineProperty(a, 'getTime', { value: function () { return 5; } });
|
|
436
|
+
st.deepEqualTest(a, b, 'two Dates with the same timestamp but one has overridden `getTime`', true, true);
|
|
437
|
+
st.end();
|
|
438
|
+
});
|
|
439
|
+
|
|
440
|
+
t.test('fake Date', { skip: !hasProto }, function (st) {
|
|
441
|
+
var a = new Date(2000);
|
|
442
|
+
var b = tag(Object.create(
|
|
443
|
+
a.__proto__, // eslint-disable-line no-proto
|
|
444
|
+
gOPDs(a)
|
|
445
|
+
), 'Date');
|
|
446
|
+
|
|
447
|
+
st.deepEqualTest(
|
|
448
|
+
a,
|
|
449
|
+
b,
|
|
450
|
+
'Date, and fake Date',
|
|
451
|
+
true,
|
|
452
|
+
true
|
|
453
|
+
);
|
|
454
|
+
|
|
455
|
+
st.end();
|
|
456
|
+
});
|
|
457
|
+
|
|
458
|
+
var a = new Date('2000');
|
|
459
|
+
var b = new Date('2000');
|
|
460
|
+
b.foo = true;
|
|
461
|
+
t.deepEqualTest(
|
|
462
|
+
a,
|
|
463
|
+
b,
|
|
464
|
+
'two identical Dates, one with an extra property',
|
|
465
|
+
true,
|
|
466
|
+
true
|
|
467
|
+
);
|
|
468
|
+
|
|
469
|
+
t.deepEqualTest(
|
|
470
|
+
new Date('2000'),
|
|
471
|
+
new Date('2001'),
|
|
472
|
+
'two inequal Dates',
|
|
473
|
+
false,
|
|
474
|
+
false
|
|
475
|
+
);
|
|
476
|
+
|
|
94
477
|
t.end();
|
|
95
478
|
});
|
|
96
479
|
|
|
97
|
-
test('buffers', function (t) {
|
|
480
|
+
test('buffers', { skip: typeof Buffer !== 'function' }, function (t) {
|
|
98
481
|
/* eslint no-buffer-constructor: 1, new-cap: 1 */
|
|
99
|
-
t.
|
|
100
|
-
|
|
482
|
+
t.deepEqualTest(
|
|
483
|
+
safeBuffer('xyz'),
|
|
484
|
+
safeBuffer('xyz'),
|
|
485
|
+
'buffers with same contents are equal',
|
|
486
|
+
true,
|
|
487
|
+
true
|
|
488
|
+
);
|
|
489
|
+
|
|
490
|
+
t.deepEqualTest(
|
|
491
|
+
safeBuffer('xyz'),
|
|
492
|
+
safeBuffer('xyy'),
|
|
493
|
+
'buffers with same length and different contents are inequal',
|
|
494
|
+
false,
|
|
495
|
+
false
|
|
496
|
+
);
|
|
497
|
+
|
|
498
|
+
t.deepEqualTest(
|
|
499
|
+
safeBuffer('xyz'),
|
|
500
|
+
safeBuffer('xy'),
|
|
501
|
+
'buffers with different length are inequal',
|
|
502
|
+
false,
|
|
503
|
+
false
|
|
504
|
+
);
|
|
101
505
|
|
|
102
506
|
t.deepEqualTest(
|
|
103
|
-
|
|
104
|
-
|
|
507
|
+
safeBuffer('abc'),
|
|
508
|
+
safeBuffer('xyz'),
|
|
105
509
|
'buffers with different contents',
|
|
106
510
|
false,
|
|
107
511
|
false
|
|
108
512
|
);
|
|
109
513
|
|
|
514
|
+
var emptyBuffer = safeBuffer('');
|
|
515
|
+
|
|
110
516
|
t.deepEqualTest(
|
|
111
|
-
|
|
517
|
+
emptyBuffer,
|
|
112
518
|
[],
|
|
113
519
|
'empty buffer and empty array',
|
|
114
520
|
false,
|
|
115
521
|
false
|
|
116
522
|
);
|
|
117
523
|
|
|
524
|
+
t.test('bufferlikes', { skip: !Object.defineProperty || !hasTypedArrays }, function (st) {
|
|
525
|
+
var fakeBuffer = {
|
|
526
|
+
0: 'a',
|
|
527
|
+
length: 1,
|
|
528
|
+
__proto__: emptyBuffer.__proto__, // eslint-disable-line no-proto
|
|
529
|
+
copy: emptyBuffer.copy,
|
|
530
|
+
slice: emptyBuffer.slice
|
|
531
|
+
};
|
|
532
|
+
Object.defineProperty(fakeBuffer, '0', { enumerable: false });
|
|
533
|
+
Object.defineProperty(fakeBuffer, 'length', { enumerable: false });
|
|
534
|
+
Object.defineProperty(fakeBuffer, 'copy', { enumerable: false });
|
|
535
|
+
Object.defineProperty(fakeBuffer, 'slice', { enumerable: false });
|
|
536
|
+
|
|
537
|
+
st.deepEqualTest(
|
|
538
|
+
safeBuffer('a'),
|
|
539
|
+
fakeBuffer,
|
|
540
|
+
'real buffer, and mildly fake buffer',
|
|
541
|
+
false,
|
|
542
|
+
false
|
|
543
|
+
);
|
|
544
|
+
|
|
545
|
+
st.test('bufferlike', { skip: buffersAreTypedArrays ? !hasSymbols || !Symbol.toStringTag : false }, function (s2t) {
|
|
546
|
+
var bufferlike = buffersAreTypedArrays ? new Uint8Array() : {};
|
|
547
|
+
Object.defineProperty(bufferlike, 'length', {
|
|
548
|
+
enumerable: false,
|
|
549
|
+
value: bufferlike.length || 0
|
|
550
|
+
});
|
|
551
|
+
Object.defineProperty(bufferlike, 'copy', {
|
|
552
|
+
enumerable: false,
|
|
553
|
+
value: emptyBuffer.copy
|
|
554
|
+
});
|
|
555
|
+
bufferlike.__proto__ = emptyBuffer.__proto__; // eslint-disable-line no-proto
|
|
556
|
+
|
|
557
|
+
s2t.deepEqualTest(
|
|
558
|
+
emptyBuffer,
|
|
559
|
+
bufferlike,
|
|
560
|
+
'empty buffer and empty bufferlike',
|
|
561
|
+
true,
|
|
562
|
+
true
|
|
563
|
+
);
|
|
564
|
+
s2t.end();
|
|
565
|
+
});
|
|
566
|
+
|
|
567
|
+
st.end();
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
t.end();
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
test('Arrays', function (t) {
|
|
574
|
+
var a = [];
|
|
575
|
+
var b = [];
|
|
576
|
+
b.foo = true;
|
|
577
|
+
|
|
578
|
+
t.deepEqualTest(
|
|
579
|
+
a,
|
|
580
|
+
b,
|
|
581
|
+
'two identical arrays, one with an extra property',
|
|
582
|
+
false,
|
|
583
|
+
false
|
|
584
|
+
);
|
|
585
|
+
|
|
586
|
+
t.end();
|
|
587
|
+
});
|
|
588
|
+
|
|
589
|
+
test('booleans', function (t) {
|
|
590
|
+
t.deepEqualTest(
|
|
591
|
+
true,
|
|
592
|
+
true,
|
|
593
|
+
'trues',
|
|
594
|
+
true,
|
|
595
|
+
true,
|
|
596
|
+
false
|
|
597
|
+
);
|
|
598
|
+
|
|
599
|
+
t.deepEqualTest(
|
|
600
|
+
false,
|
|
601
|
+
false,
|
|
602
|
+
'falses',
|
|
603
|
+
true,
|
|
604
|
+
true,
|
|
605
|
+
false
|
|
606
|
+
);
|
|
607
|
+
|
|
608
|
+
t.deepEqualTest(
|
|
609
|
+
true,
|
|
610
|
+
false,
|
|
611
|
+
'true and false',
|
|
612
|
+
false,
|
|
613
|
+
false
|
|
614
|
+
);
|
|
615
|
+
|
|
118
616
|
t.end();
|
|
119
617
|
});
|
|
120
618
|
|
|
@@ -138,39 +636,45 @@ test('booleans and arrays', function (t) {
|
|
|
138
636
|
|
|
139
637
|
test('arrays initiated', function (t) {
|
|
140
638
|
var a0 = [
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
639
|
+
undefined,
|
|
640
|
+
null,
|
|
641
|
+
-1,
|
|
642
|
+
0,
|
|
643
|
+
1,
|
|
644
|
+
false,
|
|
645
|
+
true,
|
|
646
|
+
undefined,
|
|
647
|
+
'',
|
|
648
|
+
'abc',
|
|
649
|
+
null,
|
|
650
|
+
undefined
|
|
651
|
+
];
|
|
652
|
+
var a1 = [
|
|
653
|
+
undefined,
|
|
654
|
+
null,
|
|
655
|
+
-1,
|
|
656
|
+
0,
|
|
657
|
+
1,
|
|
658
|
+
false,
|
|
659
|
+
true,
|
|
660
|
+
undefined,
|
|
661
|
+
'',
|
|
662
|
+
'abc',
|
|
663
|
+
null,
|
|
664
|
+
undefined
|
|
665
|
+
];
|
|
168
666
|
|
|
169
|
-
t.
|
|
667
|
+
t.deepEqualTest(
|
|
668
|
+
a0,
|
|
669
|
+
a1,
|
|
670
|
+
'arrays with equal contents are equal',
|
|
671
|
+
true,
|
|
672
|
+
true,
|
|
673
|
+
true
|
|
674
|
+
);
|
|
170
675
|
t.end();
|
|
171
676
|
});
|
|
172
677
|
|
|
173
|
-
// eslint-disable-next-line max-statements
|
|
174
678
|
test('arrays assigned', function (t) {
|
|
175
679
|
var a0 = [
|
|
176
680
|
undefined,
|
|
@@ -206,7 +710,6 @@ test('arrays assigned', function (t) {
|
|
|
206
710
|
t.end();
|
|
207
711
|
});
|
|
208
712
|
|
|
209
|
-
// eslint-disable-next-line max-statements
|
|
210
713
|
test('arrays push', function (t) {
|
|
211
714
|
var a0 = [
|
|
212
715
|
undefined,
|
|
@@ -244,19 +747,31 @@ test('arrays push', function (t) {
|
|
|
244
747
|
|
|
245
748
|
test('null == undefined', function (t) {
|
|
246
749
|
t.deepEqualTest(null, undefined, 'null and undefined', true, false);
|
|
750
|
+
t.deepEqualTest([null], [undefined], '[null] and [undefined]', true, false);
|
|
247
751
|
|
|
248
752
|
t.end();
|
|
249
753
|
});
|
|
250
754
|
|
|
755
|
+
// node 14 changed `deepEqual` to make two NaNs loosely equal. TODO, semver-major: change deep-equal in the same way.
|
|
756
|
+
var isNode14 = isNode && process.env.ASSERT && semver.satisfies(process.version, '>= 14');
|
|
251
757
|
test('NaNs', function (t) {
|
|
252
|
-
t.
|
|
253
|
-
|
|
758
|
+
t.deepEqualTest(
|
|
759
|
+
NaN,
|
|
760
|
+
NaN,
|
|
761
|
+
'two NaNs',
|
|
762
|
+
isNode14,
|
|
763
|
+
true
|
|
764
|
+
);
|
|
254
765
|
|
|
255
|
-
t.
|
|
256
|
-
|
|
766
|
+
t.deepEqualTest(
|
|
767
|
+
{ a: NaN },
|
|
768
|
+
{ a: NaN },
|
|
769
|
+
'two equiv objects with a NaN value',
|
|
770
|
+
isNode14,
|
|
771
|
+
true
|
|
772
|
+
);
|
|
257
773
|
|
|
258
|
-
t.
|
|
259
|
-
t.notOk(equal(NaN, 1, { strict: true }), 'strict: NaN !== 1');
|
|
774
|
+
t.deepEqualTest(NaN, 1, 'NaN and 1', false, false);
|
|
260
775
|
|
|
261
776
|
t.end();
|
|
262
777
|
});
|
|
@@ -323,6 +838,51 @@ test('regexen', function (t) {
|
|
|
323
838
|
t.deepEqualTest(/abc/, /abc/, 'two abc regexes', true, true, false);
|
|
324
839
|
t.deepEqualTest(/xyz/, /xyz/, 'two xyz regexes', true, true, false);
|
|
325
840
|
|
|
841
|
+
t.test('fake RegExp', { skip: !hasProto }, function (st) {
|
|
842
|
+
var a = /abc/g;
|
|
843
|
+
var b = tag(Object.create(
|
|
844
|
+
a.__proto__, // eslint-disable-line no-proto
|
|
845
|
+
gOPDs(a)
|
|
846
|
+
), 'RegExp');
|
|
847
|
+
|
|
848
|
+
st.deepEqualTest(a, b, 'regex and fake regex', false, false);
|
|
849
|
+
|
|
850
|
+
st.end();
|
|
851
|
+
});
|
|
852
|
+
|
|
853
|
+
var a = /abc/gi;
|
|
854
|
+
var b = /abc/gi;
|
|
855
|
+
b.foo = true;
|
|
856
|
+
t.deepEqualTest(
|
|
857
|
+
a,
|
|
858
|
+
b,
|
|
859
|
+
'two identical regexes, one with an extra property',
|
|
860
|
+
true,
|
|
861
|
+
true
|
|
862
|
+
);
|
|
863
|
+
|
|
864
|
+
var c = /abc/g;
|
|
865
|
+
var d = /abc/i;
|
|
866
|
+
t.deepEqualTest(
|
|
867
|
+
c,
|
|
868
|
+
d,
|
|
869
|
+
'two regexes with the same source but different flags',
|
|
870
|
+
false,
|
|
871
|
+
false
|
|
872
|
+
);
|
|
873
|
+
|
|
874
|
+
t.end();
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
test('object literals', function (t) {
|
|
878
|
+
t.deepEqualTest(
|
|
879
|
+
{ prototype: 2 },
|
|
880
|
+
{ prototype: '2' },
|
|
881
|
+
'two loosely equal, strictly inequal prototype properties',
|
|
882
|
+
false,
|
|
883
|
+
false
|
|
884
|
+
);
|
|
885
|
+
|
|
326
886
|
t.end();
|
|
327
887
|
});
|
|
328
888
|
|
|
@@ -338,7 +898,446 @@ test('functions', function (t) {
|
|
|
338
898
|
function f() {}
|
|
339
899
|
|
|
340
900
|
t.deepEqualTest(f, f, 'a function and itself', true, true, true);
|
|
901
|
+
t.deepEqualTest([f], [f], 'a function and itself in an array', true, true, true);
|
|
902
|
+
|
|
341
903
|
t.deepEqualTest(function () {}, function () {}, 'two distinct functions', false, false, true);
|
|
904
|
+
t.deepEqualTest([function () {}], [function () {}], 'two distinct functions in an array', false, false, true);
|
|
905
|
+
|
|
906
|
+
t.deepEqualTest(f, {}, 'function and object', false, false, true);
|
|
907
|
+
t.deepEqualTest([f], [{}], 'function and object in an array', false, false, true);
|
|
908
|
+
|
|
909
|
+
t.end();
|
|
910
|
+
});
|
|
911
|
+
|
|
912
|
+
test('Errors', function (t) {
|
|
913
|
+
t.deepEqualTest(new Error('xyz'), new Error('xyz'), 'two errors of the same type with the same message', true, true, false);
|
|
914
|
+
t.deepEqualTest(new Error('xyz'), new TypeError('xyz'), 'two errors of different types with the same message', true, true);
|
|
915
|
+
t.deepEqualTest(new Error('xyz'), new Error('zyx'), 'two errors of the same type with a different message', true, true);
|
|
916
|
+
|
|
917
|
+
t.test('errorlike', { skip: !Object.defineProperty }, function (st) {
|
|
918
|
+
var err = new Error('foo');
|
|
919
|
+
// TODO: add `__proto__` when brand check is available
|
|
920
|
+
var errorlike = tag({ message: err.message, stack: err.stack, name: err.name, constructor: err.constructor }, 'Error');
|
|
921
|
+
Object.defineProperty(errorlike, 'message', { enumerable: false });
|
|
922
|
+
Object.defineProperty(errorlike, 'stack', { enumerable: false });
|
|
923
|
+
Object.defineProperty(errorlike, 'name', { enumerable: false });
|
|
924
|
+
Object.defineProperty(errorlike, 'constructor', { enumerable: false });
|
|
925
|
+
st.notOk(errorlike instanceof Error);
|
|
926
|
+
st.ok(err instanceof Error);
|
|
927
|
+
st.deepEqualTest(
|
|
928
|
+
err,
|
|
929
|
+
errorlike,
|
|
930
|
+
'error, and errorlike object',
|
|
931
|
+
true,
|
|
932
|
+
true
|
|
933
|
+
);
|
|
934
|
+
|
|
935
|
+
st.end();
|
|
936
|
+
});
|
|
937
|
+
|
|
938
|
+
t.deepEqualTest(
|
|
939
|
+
new Error('a'),
|
|
940
|
+
assign(new Error('a'), { code: 10 }),
|
|
941
|
+
'two otherwise equal errors with different own properties',
|
|
942
|
+
false,
|
|
943
|
+
false
|
|
944
|
+
);
|
|
945
|
+
|
|
946
|
+
t.test('fake error', { skip: !process.env.ASSERT || !hasProto }, function (st) {
|
|
947
|
+
var a = tag({
|
|
948
|
+
__proto__: null
|
|
949
|
+
}, 'Error');
|
|
950
|
+
var b = new RangeError('abc');
|
|
951
|
+
b.__proto__ = null; // eslint-disable-line no-proto
|
|
952
|
+
|
|
953
|
+
st.deepEqualTest(
|
|
954
|
+
a,
|
|
955
|
+
b,
|
|
956
|
+
'null object faking as an Error, RangeError with null proto',
|
|
957
|
+
false,
|
|
958
|
+
false
|
|
959
|
+
);
|
|
960
|
+
st.end();
|
|
961
|
+
});
|
|
962
|
+
|
|
963
|
+
t.end();
|
|
964
|
+
});
|
|
965
|
+
|
|
966
|
+
test('object and null', function (t) {
|
|
967
|
+
t.deepEqualTest(
|
|
968
|
+
{},
|
|
969
|
+
null,
|
|
970
|
+
'null and an object',
|
|
971
|
+
false,
|
|
972
|
+
false
|
|
973
|
+
);
|
|
974
|
+
|
|
975
|
+
t.end();
|
|
976
|
+
});
|
|
977
|
+
|
|
978
|
+
test('errors', function (t) {
|
|
979
|
+
|
|
980
|
+
t.end();
|
|
981
|
+
});
|
|
982
|
+
|
|
983
|
+
test('error = Object', function (t) {
|
|
984
|
+
t.deepEqualTest(
|
|
985
|
+
new Error('a'),
|
|
986
|
+
{ message: 'a' },
|
|
987
|
+
false,
|
|
988
|
+
false
|
|
989
|
+
);
|
|
990
|
+
|
|
991
|
+
t.end();
|
|
992
|
+
});
|
|
993
|
+
|
|
994
|
+
test('[[Prototypes]]', function (t) {
|
|
995
|
+
function C() {}
|
|
996
|
+
var instance = new C();
|
|
997
|
+
delete instance.constructor;
|
|
998
|
+
|
|
999
|
+
t.deepEqualTest({}, instance, 'two identical objects with different [[Prototypes]]', true, true);
|
|
1000
|
+
|
|
1001
|
+
t.test('Dates with different prototypes', { skip: !hasProto }, function (st) {
|
|
1002
|
+
var d1 = new Date(0);
|
|
1003
|
+
var d2 = new Date(0);
|
|
1004
|
+
|
|
1005
|
+
st.deepEqualTest(d1, d2, 'two dates with the same timestamp', true, true);
|
|
1006
|
+
|
|
1007
|
+
var newProto = {
|
|
1008
|
+
__proto__: Date.prototype
|
|
1009
|
+
};
|
|
1010
|
+
d2.__proto__ = newProto; // eslint-disable-line no-proto
|
|
1011
|
+
st.ok(d2 instanceof Date, 'd2 is still a Date instance after tweaking [[Prototype]]');
|
|
1012
|
+
|
|
1013
|
+
st.deepEqualTest(d1, d2, 'two dates with the same timestamp and different [[Prototype]]', true, true);
|
|
1014
|
+
|
|
1015
|
+
st.end();
|
|
1016
|
+
});
|
|
1017
|
+
|
|
1018
|
+
t.end();
|
|
1019
|
+
});
|
|
1020
|
+
|
|
1021
|
+
test('toStringTag', { skip: !hasSymbols || !Symbol.toStringTag }, function (t) {
|
|
1022
|
+
var o1 = {};
|
|
1023
|
+
t.equal(Object.prototype.toString.call(o1), '[object Object]', 'o1: Symbol.toStringTag works');
|
|
1024
|
+
|
|
1025
|
+
var o2 = {};
|
|
1026
|
+
t.equal(Object.prototype.toString.call(o2), '[object Object]', 'o2: original Symbol.toStringTag works');
|
|
1027
|
+
|
|
1028
|
+
t.deepEqualTest(o1, o2, 'two normal empty objects', true, true);
|
|
1029
|
+
|
|
1030
|
+
o2[Symbol.toStringTag] = 'jifasnif';
|
|
1031
|
+
t.equal(Object.prototype.toString.call(o2), '[object jifasnif]', 'o2: modified Symbol.toStringTag works');
|
|
1032
|
+
|
|
1033
|
+
t.deepEqualTest(o1, o2, 'two normal empty objects with different toStringTags', true, true);
|
|
1034
|
+
|
|
1035
|
+
t.end();
|
|
1036
|
+
});
|
|
1037
|
+
|
|
1038
|
+
test('boxed primitives', function (t) {
|
|
1039
|
+
t.deepEqualTest(Object(false), false, 'boxed and primitive `false`', true, false);
|
|
1040
|
+
t.deepEqualTest(Object(true), true, 'boxed and primitive `true`', false, false);
|
|
1041
|
+
t.deepEqualTest(Object(3), 3, 'boxed and primitive `3`', false, false);
|
|
1042
|
+
t.deepEqualTest(Object(NaN), NaN, 'boxed and primitive `NaN`', false, false);
|
|
1043
|
+
t.deepEqualTest(Object(''), '', 'boxed and primitive `""`', true, false);
|
|
1044
|
+
t.deepEqualTest(Object('str'), 'str', 'boxed and primitive `"str"`', false, false);
|
|
1045
|
+
|
|
1046
|
+
t.test('symbol', { skip: !hasSymbols }, function (st) {
|
|
1047
|
+
var s = Symbol('');
|
|
1048
|
+
st.deepEqualTest(Object(s), s, 'boxed and primitive `Symbol()`', false, false);
|
|
1049
|
+
st.end();
|
|
1050
|
+
});
|
|
1051
|
+
|
|
1052
|
+
t.test('bigint', { skip: typeof BigInt !== 'function' }, function (st) {
|
|
1053
|
+
var hhgtg = BigInt(42);
|
|
1054
|
+
st.deepEqualTest(Object(hhgtg), hhgtg, 'boxed and primitive `BigInt(42)`', false, false);
|
|
1055
|
+
st.end();
|
|
1056
|
+
});
|
|
1057
|
+
|
|
1058
|
+
t.test('`valueOf` is called for boxed primitives', function (st) {
|
|
1059
|
+
var a = Object(5);
|
|
1060
|
+
a.valueOf = function () { throw new Error('failed'); };
|
|
1061
|
+
var b = Object(5);
|
|
1062
|
+
b.valueOf = function () { throw new Error('failed'); };
|
|
1063
|
+
|
|
1064
|
+
st.deepEqualTest(a, b, 'two boxed numbers with a thrower valueOf', false, false);
|
|
1065
|
+
|
|
1066
|
+
st.end();
|
|
1067
|
+
});
|
|
1068
|
+
|
|
1069
|
+
t.end();
|
|
1070
|
+
});
|
|
1071
|
+
|
|
1072
|
+
test('getters', { skip: !Object.defineProperty }, function (t) {
|
|
1073
|
+
var a = {};
|
|
1074
|
+
Object.defineProperty(a, 'a', { enumerable: true, get: function () { return 5; } });
|
|
1075
|
+
var b = {};
|
|
1076
|
+
Object.defineProperty(b, 'a', { enumerable: true, get: function () { return 6; } });
|
|
1077
|
+
|
|
1078
|
+
t.deepEqualTest(a, b, 'two objects with the same getter but producing different values', false, false);
|
|
1079
|
+
|
|
1080
|
+
t.end();
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
var isBrokenNode = isNode && process.env.ASSERT && semver.satisfies(process.version, '<= 13.3.0');
|
|
1084
|
+
test('fake arrays: extra keys will be tested', { skip: !hasProto || isBrokenNode }, function (t) {
|
|
1085
|
+
var a = tag({
|
|
1086
|
+
__proto__: Array.prototype,
|
|
1087
|
+
0: 1,
|
|
1088
|
+
1: 1,
|
|
1089
|
+
2: 'broken',
|
|
1090
|
+
length: 2
|
|
1091
|
+
}, 'Array');
|
|
1092
|
+
if (Object.defineProperty) {
|
|
1093
|
+
Object.defineProperty(a, 'length', {
|
|
1094
|
+
enumerable: false
|
|
1095
|
+
});
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
t.deepEqualTest(a, [1, 1], 'fake and real array with same contents and [[Prototype]]', false, false);
|
|
1099
|
+
|
|
1100
|
+
var b = tag(/abc/, 'Array');
|
|
1101
|
+
b.__proto__ = Array.prototype; // eslint-disable-line no-proto
|
|
1102
|
+
b.length = 3;
|
|
1103
|
+
if (Object.defineProperty) {
|
|
1104
|
+
Object.defineProperty(b, 'length', {
|
|
1105
|
+
enumerable: false
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
t.deepEqualTest(b, ['a', 'b', 'c'], 'regex faking as array, and array', false, false);
|
|
1109
|
+
|
|
1110
|
+
t.end();
|
|
1111
|
+
});
|
|
1112
|
+
|
|
1113
|
+
test('circular references', { skip: 'not supported until v2' }, function (t) {
|
|
1114
|
+
var b = {};
|
|
1115
|
+
b.b = b;
|
|
1116
|
+
|
|
1117
|
+
var c = {};
|
|
1118
|
+
c.b = c;
|
|
1119
|
+
|
|
1120
|
+
t.deepEqualTest(
|
|
1121
|
+
b,
|
|
1122
|
+
c,
|
|
1123
|
+
'two self-referencing objects',
|
|
1124
|
+
true,
|
|
1125
|
+
true
|
|
1126
|
+
);
|
|
1127
|
+
|
|
1128
|
+
var d = {};
|
|
1129
|
+
d.a = 1;
|
|
1130
|
+
d.b = d;
|
|
1131
|
+
|
|
1132
|
+
var e = {};
|
|
1133
|
+
e.a = 1;
|
|
1134
|
+
e.b = e.a;
|
|
1135
|
+
|
|
1136
|
+
t.deepEqualTest(
|
|
1137
|
+
d,
|
|
1138
|
+
e,
|
|
1139
|
+
'two deeply self-referencing objects',
|
|
1140
|
+
false,
|
|
1141
|
+
false
|
|
1142
|
+
);
|
|
1143
|
+
|
|
1144
|
+
t.end();
|
|
1145
|
+
});
|
|
1146
|
+
|
|
1147
|
+
// io.js v2 is the only version where `console.log(b)` below is catchable
|
|
1148
|
+
var isNodeWhereBufferBreaks = isNode && semver.satisfies(process.version, '< 3');
|
|
1149
|
+
var isNode06 = isNode && semver.satisfies(process.version, '<= 0.6'); // segfaults in node 0.6, it seems
|
|
1150
|
+
|
|
1151
|
+
test('TypedArrays', { skip: !hasTypedArrays }, function (t) {
|
|
1152
|
+
t.test('Buffer faked as Uint8Array', { skip: typeof Buffer !== 'function' || !Object.create || !hasProto || isNode06 }, function (st) {
|
|
1153
|
+
var a = safeBuffer('test');
|
|
1154
|
+
var b = tag(Object.create(
|
|
1155
|
+
a.__proto__, // eslint-disable-line no-proto
|
|
1156
|
+
assign(gOPDs(a), {
|
|
1157
|
+
length: {
|
|
1158
|
+
enumerable: false,
|
|
1159
|
+
value: 4
|
|
1160
|
+
}
|
|
1161
|
+
})
|
|
1162
|
+
), 'Uint8Array');
|
|
1163
|
+
|
|
1164
|
+
st.deepEqualTest(
|
|
1165
|
+
a,
|
|
1166
|
+
b,
|
|
1167
|
+
'Buffer and Uint8Array',
|
|
1168
|
+
true || isNodeWhereBufferBreaks,
|
|
1169
|
+
true || isNodeWhereBufferBreaks
|
|
1170
|
+
);
|
|
1171
|
+
|
|
1172
|
+
st.end();
|
|
1173
|
+
});
|
|
1174
|
+
|
|
1175
|
+
forEach(availableTypedArrays, function (name) {
|
|
1176
|
+
t.test(name + 's', function (st) {
|
|
1177
|
+
var TA = global[name];
|
|
1178
|
+
var isBigInt = name.slice(0, 3) === 'Big';
|
|
1179
|
+
var Z = isBigInt ? BigInt : Number;
|
|
1180
|
+
|
|
1181
|
+
st.deepEqualTest(
|
|
1182
|
+
new TA([Z(1), Z(2), Z(3)]),
|
|
1183
|
+
new TA([Z(1), Z(2), Z(3)]),
|
|
1184
|
+
'two ' + name + 's with the same contents',
|
|
1185
|
+
true,
|
|
1186
|
+
true
|
|
1187
|
+
);
|
|
1188
|
+
|
|
1189
|
+
st.deepEqualTest(
|
|
1190
|
+
new TA([Z(1), Z(2), Z(3)]),
|
|
1191
|
+
new TA([Z(1), Z(2), Z(4)]),
|
|
1192
|
+
'two ' + name + 's with different contents',
|
|
1193
|
+
false,
|
|
1194
|
+
false
|
|
1195
|
+
);
|
|
1196
|
+
|
|
1197
|
+
st.end();
|
|
1198
|
+
});
|
|
1199
|
+
});
|
|
1200
|
+
|
|
1201
|
+
t.test('one TypedArray faking as another', { skip: !hasProto }, function (st) {
|
|
1202
|
+
var a = new Uint8Array(10);
|
|
1203
|
+
var b = tag(new Int8Array(10), 'Uint8Array');
|
|
1204
|
+
b.__proto__ = Uint8Array.prototype; // eslint-disable-line no-proto
|
|
1205
|
+
defineDataProperty(b, 'length', 10);
|
|
1206
|
+
|
|
1207
|
+
st.deepEqualTest(
|
|
1208
|
+
a,
|
|
1209
|
+
b,
|
|
1210
|
+
'Uint8Array, and Int8Array pretending to be a Uint8Array',
|
|
1211
|
+
false,
|
|
1212
|
+
false
|
|
1213
|
+
);
|
|
1214
|
+
|
|
1215
|
+
st.end();
|
|
1216
|
+
});
|
|
1217
|
+
|
|
1218
|
+
t.test('ArrayBuffers', { skip: typeof ArrayBuffer !== 'function' }, function (st) {
|
|
1219
|
+
var buffer1 = new ArrayBuffer(8); // initial value of 0's
|
|
1220
|
+
var buffer2 = new ArrayBuffer(8); // initial value of 0's
|
|
1221
|
+
|
|
1222
|
+
var view1 = new Int8Array(buffer1);
|
|
1223
|
+
var view2 = new Int8Array(buffer2);
|
|
1224
|
+
|
|
1225
|
+
st.deepEqualTest(
|
|
1226
|
+
view1,
|
|
1227
|
+
view2,
|
|
1228
|
+
'Int8Arrays of similar ArrayBuffers',
|
|
1229
|
+
true,
|
|
1230
|
+
true
|
|
1231
|
+
);
|
|
1232
|
+
|
|
1233
|
+
st.deepEqualTest(
|
|
1234
|
+
buffer1,
|
|
1235
|
+
buffer2,
|
|
1236
|
+
'similar ArrayBuffers',
|
|
1237
|
+
true,
|
|
1238
|
+
true
|
|
1239
|
+
);
|
|
1240
|
+
|
|
1241
|
+
for (var i = 0; i < view1.byteLength; i += 1) {
|
|
1242
|
+
view1[i] = 9; // change all values to 9's
|
|
1243
|
+
}
|
|
1244
|
+
|
|
1245
|
+
st.deepEqualTest(
|
|
1246
|
+
view1,
|
|
1247
|
+
view2,
|
|
1248
|
+
'Int8Arrays of different ArrayBuffers',
|
|
1249
|
+
false,
|
|
1250
|
+
false
|
|
1251
|
+
);
|
|
1252
|
+
|
|
1253
|
+
var isHigherThanNode010 = isNode && semver.satisfies(process.version, '> 0.10');
|
|
1254
|
+
st.deepEqualTest(
|
|
1255
|
+
buffer1,
|
|
1256
|
+
buffer2,
|
|
1257
|
+
'different ArrayBuffers',
|
|
1258
|
+
isHigherThanNode010,
|
|
1259
|
+
isHigherThanNode010
|
|
1260
|
+
);
|
|
1261
|
+
|
|
1262
|
+
// node < 0.11 has a nonconfigurable own byteLength property
|
|
1263
|
+
t.test('lies about byteLength', { skip: !('byteLength' in ArrayBuffer.prototype) }, function (s2t) {
|
|
1264
|
+
var empty4 = new ArrayBuffer(4);
|
|
1265
|
+
var empty6 = new ArrayBuffer(6);
|
|
1266
|
+
Object.defineProperty(empty6, 'byteLength', { value: 4 });
|
|
1267
|
+
|
|
1268
|
+
s2t.deepEqualTest(
|
|
1269
|
+
empty4,
|
|
1270
|
+
empty6,
|
|
1271
|
+
'different-length ArrayBuffers, one lying',
|
|
1272
|
+
true,
|
|
1273
|
+
true
|
|
1274
|
+
);
|
|
1275
|
+
s2t.end();
|
|
1276
|
+
});
|
|
1277
|
+
|
|
1278
|
+
st.end();
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
t.test('SharedArrayBuffers', { skip: typeof SharedArrayBuffer !== 'function' }, function (st) {
|
|
1282
|
+
var buffer1 = new SharedArrayBuffer(8); // initial value of 0's
|
|
1283
|
+
var buffer2 = new SharedArrayBuffer(8); // initial value of 0's
|
|
1284
|
+
|
|
1285
|
+
var view1 = new Int8Array(buffer1);
|
|
1286
|
+
var view2 = new Int8Array(buffer2);
|
|
1287
|
+
|
|
1288
|
+
st.deepEqualTest(
|
|
1289
|
+
view1,
|
|
1290
|
+
view2,
|
|
1291
|
+
'Int8Arrays of similar SharedArrayBuffers',
|
|
1292
|
+
true,
|
|
1293
|
+
true
|
|
1294
|
+
);
|
|
1295
|
+
|
|
1296
|
+
st.deepEqualTest(
|
|
1297
|
+
buffer1,
|
|
1298
|
+
buffer2,
|
|
1299
|
+
'similar SharedArrayBuffers',
|
|
1300
|
+
true,
|
|
1301
|
+
true
|
|
1302
|
+
);
|
|
1303
|
+
|
|
1304
|
+
for (var i = 0; i < view1.byteLength; i += 1) {
|
|
1305
|
+
view1[i] = 9; // change all values to 9's
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
st.deepEqualTest(
|
|
1309
|
+
view1,
|
|
1310
|
+
view2,
|
|
1311
|
+
'Int8Arrays of different SharedArrayBuffers',
|
|
1312
|
+
false,
|
|
1313
|
+
false
|
|
1314
|
+
);
|
|
1315
|
+
|
|
1316
|
+
st.deepEqualTest(
|
|
1317
|
+
buffer1,
|
|
1318
|
+
buffer2,
|
|
1319
|
+
'different SharedArrayBuffers',
|
|
1320
|
+
true,
|
|
1321
|
+
true
|
|
1322
|
+
);
|
|
1323
|
+
|
|
1324
|
+
t.test('lies about byteLength', { skip: !('byteLength' in SharedArrayBuffer.prototype) }, function (s2t) {
|
|
1325
|
+
var empty4 = new SharedArrayBuffer(4);
|
|
1326
|
+
var empty6 = new SharedArrayBuffer(6);
|
|
1327
|
+
Object.defineProperty(empty6, 'byteLength', { value: 4 });
|
|
1328
|
+
|
|
1329
|
+
s2t.deepEqualTest(
|
|
1330
|
+
empty4,
|
|
1331
|
+
empty6,
|
|
1332
|
+
'different-length SharedArrayBuffers, one lying',
|
|
1333
|
+
true,
|
|
1334
|
+
true
|
|
1335
|
+
);
|
|
1336
|
+
s2t.end();
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
st.end();
|
|
1340
|
+
});
|
|
342
1341
|
|
|
343
1342
|
t.end();
|
|
344
1343
|
});
|