node-red-contrib-web-worldmap 2.29.0 → 2.30.1
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/.github/FUNDING.yml +13 -0
- package/CHANGELOG.md +5 -2
- package/README.md +3 -0
- package/node_modules/array-flatten/package.json +6 -9
- package/node_modules/body-parser/HISTORY.md +18 -0
- package/node_modules/body-parser/README.md +9 -1
- package/node_modules/body-parser/SECURITY.md +25 -0
- package/node_modules/body-parser/lib/read.js +26 -2
- package/node_modules/body-parser/lib/types/json.js +10 -4
- package/node_modules/body-parser/package.json +24 -20
- package/node_modules/call-bind/.eslintignore +1 -0
- package/node_modules/call-bind/.eslintrc +17 -0
- package/node_modules/call-bind/.github/FUNDING.yml +12 -0
- package/node_modules/call-bind/.nycrc +13 -0
- package/node_modules/call-bind/CHANGELOG.md +42 -0
- package/node_modules/call-bind/LICENSE +21 -0
- package/node_modules/call-bind/README.md +2 -0
- package/node_modules/call-bind/callBound.js +15 -0
- package/node_modules/call-bind/index.js +47 -0
- package/node_modules/call-bind/package.json +108 -0
- package/node_modules/call-bind/test/callBound.js +55 -0
- package/node_modules/call-bind/test/index.js +66 -0
- package/node_modules/cookie/HISTORY.md +8 -0
- package/node_modules/cookie/README.md +50 -34
- package/node_modules/cookie/SECURITY.md +25 -0
- package/node_modules/cookie/index.js +83 -15
- package/node_modules/cookie/package.json +17 -15
- package/node_modules/cookie-signature/package.json +6 -9
- package/node_modules/depd/History.md +7 -0
- package/node_modules/depd/LICENSE +1 -1
- package/node_modules/depd/Readme.md +8 -8
- package/node_modules/depd/index.js +29 -13
- package/node_modules/depd/package.json +25 -24
- package/node_modules/destroy/LICENSE +1 -0
- package/node_modules/destroy/README.md +15 -12
- package/node_modules/destroy/index.js +147 -13
- package/node_modules/destroy/package.json +29 -20
- package/node_modules/ee-first/package.json +6 -9
- package/node_modules/encodeurl/package.json +11 -14
- package/node_modules/escape-html/package.json +11 -14
- package/node_modules/etag/package.json +11 -14
- package/node_modules/express/History.md +54 -0
- package/node_modules/express/Readme.md +39 -31
- package/node_modules/express/lib/application.js +18 -1
- package/node_modules/express/lib/response.js +40 -18
- package/node_modules/express/lib/router/index.js +20 -15
- package/node_modules/express/lib/router/route.js +9 -0
- package/node_modules/express/lib/utils.js +1 -0
- package/node_modules/express/lib/view.js +1 -1
- package/node_modules/express/package.json +25 -26
- package/node_modules/finalhandler/HISTORY.md +8 -0
- package/node_modules/finalhandler/LICENSE +1 -1
- package/node_modules/finalhandler/README.md +5 -6
- package/node_modules/finalhandler/SECURITY.md +25 -0
- package/node_modules/finalhandler/index.js +8 -3
- package/node_modules/finalhandler/package.json +30 -32
- package/node_modules/fresh/package.json +6 -9
- package/node_modules/function-bind/.editorconfig +20 -0
- package/node_modules/function-bind/.eslintrc +15 -0
- package/node_modules/function-bind/.jscs.json +176 -0
- package/node_modules/function-bind/.npmignore +22 -0
- package/node_modules/function-bind/.travis.yml +168 -0
- package/node_modules/function-bind/LICENSE +20 -0
- package/node_modules/function-bind/README.md +48 -0
- package/node_modules/function-bind/implementation.js +52 -0
- package/node_modules/function-bind/index.js +5 -0
- package/node_modules/function-bind/package.json +96 -0
- package/node_modules/function-bind/test/.eslintrc +9 -0
- package/node_modules/function-bind/test/index.js +252 -0
- package/node_modules/get-intrinsic/.eslintrc +37 -0
- package/node_modules/get-intrinsic/.github/FUNDING.yml +12 -0
- package/node_modules/get-intrinsic/.nycrc +9 -0
- package/node_modules/get-intrinsic/CHANGELOG.md +98 -0
- package/node_modules/get-intrinsic/LICENSE +21 -0
- package/node_modules/get-intrinsic/README.md +71 -0
- package/node_modules/get-intrinsic/index.js +334 -0
- package/node_modules/get-intrinsic/package.json +120 -0
- package/node_modules/get-intrinsic/test/GetIntrinsic.js +274 -0
- package/node_modules/has/LICENSE-MIT +22 -0
- package/node_modules/has/README.md +18 -0
- package/node_modules/has/package.json +73 -0
- package/node_modules/has/src/index.js +5 -0
- package/node_modules/has/test/index.js +10 -0
- package/node_modules/has-symbols/.eslintrc +11 -0
- package/node_modules/has-symbols/.github/FUNDING.yml +12 -0
- package/node_modules/has-symbols/.nycrc +9 -0
- package/node_modules/has-symbols/CHANGELOG.md +75 -0
- package/node_modules/has-symbols/LICENSE +21 -0
- package/node_modules/has-symbols/README.md +46 -0
- package/node_modules/has-symbols/index.js +13 -0
- package/node_modules/has-symbols/package.json +126 -0
- package/node_modules/has-symbols/shams.js +42 -0
- package/node_modules/has-symbols/test/index.js +22 -0
- package/node_modules/has-symbols/test/shams/core-js.js +28 -0
- package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +28 -0
- package/node_modules/has-symbols/test/tests.js +56 -0
- package/node_modules/http-errors/HISTORY.md +15 -0
- package/node_modules/http-errors/README.md +2 -2
- package/node_modules/http-errors/index.js +15 -25
- package/node_modules/http-errors/package.json +22 -20
- package/node_modules/media-typer/package.json +6 -9
- package/node_modules/merge-descriptors/package.json +6 -9
- package/node_modules/methods/package.json +11 -14
- package/node_modules/object-inspect/.eslintrc +53 -0
- package/node_modules/object-inspect/.github/FUNDING.yml +12 -0
- package/node_modules/object-inspect/.nycrc +13 -0
- package/node_modules/object-inspect/CHANGELOG.md +360 -0
- package/node_modules/object-inspect/LICENSE +21 -0
- package/node_modules/object-inspect/example/all.js +23 -0
- package/node_modules/object-inspect/example/circular.js +6 -0
- package/node_modules/object-inspect/example/fn.js +5 -0
- package/node_modules/object-inspect/example/inspect.js +10 -0
- package/node_modules/object-inspect/index.js +512 -0
- package/node_modules/object-inspect/package-support.json +20 -0
- package/node_modules/object-inspect/package.json +122 -0
- package/node_modules/object-inspect/readme.markdown +86 -0
- package/node_modules/object-inspect/test/bigint.js +58 -0
- package/node_modules/object-inspect/test/browser/dom.js +15 -0
- package/node_modules/object-inspect/test/circular.js +16 -0
- package/node_modules/object-inspect/test/deep.js +12 -0
- package/node_modules/object-inspect/test/element.js +53 -0
- package/node_modules/object-inspect/test/err.js +48 -0
- package/node_modules/object-inspect/test/fakes.js +29 -0
- package/node_modules/object-inspect/test/fn.js +76 -0
- package/node_modules/object-inspect/test/has.js +15 -0
- package/node_modules/object-inspect/test/holes.js +15 -0
- package/node_modules/object-inspect/test/indent-option.js +271 -0
- package/node_modules/object-inspect/test/inspect.js +139 -0
- package/node_modules/object-inspect/test/lowbyte.js +12 -0
- package/node_modules/object-inspect/test/number.js +58 -0
- package/node_modules/object-inspect/test/quoteStyle.js +17 -0
- package/node_modules/object-inspect/test/toStringTag.js +40 -0
- package/node_modules/object-inspect/test/undef.js +12 -0
- package/node_modules/object-inspect/test/values.js +211 -0
- package/node_modules/object-inspect/test-core-js.js +26 -0
- package/node_modules/object-inspect/util.inspect.js +1 -0
- package/node_modules/on-finished/HISTORY.md +10 -0
- package/node_modules/on-finished/README.md +28 -20
- package/node_modules/on-finished/index.js +51 -13
- package/node_modules/on-finished/package.json +25 -20
- package/node_modules/path-to-regexp/package.json +6 -9
- package/node_modules/qs/CHANGELOG.md +22 -5
- package/node_modules/qs/README.md +7 -0
- package/node_modules/qs/dist/qs.js +1207 -5
- package/node_modules/qs/lib/parse.js +6 -0
- package/node_modules/qs/lib/stringify.js +33 -3
- package/node_modules/qs/package.json +16 -13
- package/node_modules/qs/test/parse.js +9 -0
- package/node_modules/qs/test/stringify.js +62 -1
- package/node_modules/raw-body/HISTORY.md +14 -0
- package/node_modules/raw-body/LICENSE +1 -1
- package/node_modules/raw-body/README.md +4 -0
- package/node_modules/raw-body/SECURITY.md +24 -0
- package/node_modules/raw-body/index.js +45 -2
- package/node_modules/raw-body/package.json +16 -15
- package/node_modules/send/HISTORY.md +15 -0
- package/node_modules/send/LICENSE +1 -1
- package/node_modules/send/README.md +2 -2
- package/node_modules/send/SECURITY.md +24 -0
- package/node_modules/send/index.js +37 -27
- package/node_modules/send/package.json +22 -21
- package/node_modules/serve-static/HISTORY.md +12 -0
- package/node_modules/serve-static/README.md +1 -1
- package/node_modules/serve-static/package.json +16 -16
- package/node_modules/side-channel/.eslintignore +1 -0
- package/node_modules/side-channel/.eslintrc +11 -0
- package/node_modules/side-channel/.github/FUNDING.yml +12 -0
- package/node_modules/side-channel/.nycrc +13 -0
- package/node_modules/side-channel/CHANGELOG.md +65 -0
- package/node_modules/side-channel/LICENSE +21 -0
- package/node_modules/side-channel/README.md +2 -0
- package/node_modules/side-channel/index.js +124 -0
- package/node_modules/side-channel/package.json +95 -0
- package/node_modules/side-channel/test/index.js +78 -0
- package/node_modules/statuses/HISTORY.md +17 -0
- package/node_modules/statuses/README.md +51 -42
- package/node_modules/statuses/codes.json +2 -3
- package/node_modules/statuses/index.js +52 -19
- package/node_modules/statuses/package.json +29 -31
- package/node_modules/unpipe/package.json +7 -9
- package/node_modules/utils-merge/package.json +6 -9
- package/package.json +2 -2
- package/worldmap/worldmap.js +22 -7
- package/worldmap.html +16 -0
- package/worldmap.js +553 -551
- package/node_modules/depd/lib/compat/callsite-tostring.js +0 -103
- package/node_modules/depd/lib/compat/event-listener-count.js +0 -22
- package/node_modules/depd/lib/compat/index.js +0 -79
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# object-inspect <sup>[![Version Badge][2]][1]</sup>
|
|
2
|
+
|
|
3
|
+
string representations of objects in node and the browser
|
|
4
|
+
|
|
5
|
+
[![github actions][actions-image]][actions-url]
|
|
6
|
+
[![coverage][codecov-image]][codecov-url]
|
|
7
|
+
[![dependency status][5]][6]
|
|
8
|
+
[![dev dependency status][7]][8]
|
|
9
|
+
[![License][license-image]][license-url]
|
|
10
|
+
[![Downloads][downloads-image]][downloads-url]
|
|
11
|
+
|
|
12
|
+
[![npm badge][11]][1]
|
|
13
|
+
|
|
14
|
+
# example
|
|
15
|
+
|
|
16
|
+
## circular
|
|
17
|
+
|
|
18
|
+
``` js
|
|
19
|
+
var inspect = require('object-inspect');
|
|
20
|
+
var obj = { a: 1, b: [3,4] };
|
|
21
|
+
obj.c = obj;
|
|
22
|
+
console.log(inspect(obj));
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## dom element
|
|
26
|
+
|
|
27
|
+
``` js
|
|
28
|
+
var inspect = require('object-inspect');
|
|
29
|
+
|
|
30
|
+
var d = document.createElement('div');
|
|
31
|
+
d.setAttribute('id', 'beep');
|
|
32
|
+
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
|
33
|
+
|
|
34
|
+
console.log(inspect([ d, { a: 3, b : 4, c: [5,6,[7,[8,[9]]]] } ]));
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
output:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [ ... ] ] ] ] } ]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
# methods
|
|
44
|
+
|
|
45
|
+
``` js
|
|
46
|
+
var inspect = require('object-inspect')
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## var s = inspect(obj, opts={})
|
|
50
|
+
|
|
51
|
+
Return a string `s` with the string representation of `obj` up to a depth of `opts.depth`.
|
|
52
|
+
|
|
53
|
+
Additional options:
|
|
54
|
+
- `quoteStyle`: must be "single" or "double", if present. Default `'single'` for strings, `'double'` for HTML elements.
|
|
55
|
+
- `maxStringLength`: must be `0`, a positive integer, `Infinity`, or `null`, if present. Default `Infinity`.
|
|
56
|
+
- `customInspect`: When `true`, a custom inspect method function will be invoked (either undere the `util.inspect.custom` symbol, or the `inspect` property). When the string `'symbol'`, only the symbol method will be invoked. Default `true`.
|
|
57
|
+
- `indent`: must be "\t", `null`, or a positive integer. Default `null`.
|
|
58
|
+
- `numericSeparator`: must be a boolean, if present. Default `false`. If `true`, all numbers will be printed with numeric separators (eg, `1234.5678` will be printed as `'1_234.567_8'`)
|
|
59
|
+
|
|
60
|
+
# install
|
|
61
|
+
|
|
62
|
+
With [npm](https://npmjs.org) do:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
npm install object-inspect
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
# license
|
|
69
|
+
|
|
70
|
+
MIT
|
|
71
|
+
|
|
72
|
+
[1]: https://npmjs.org/package/object-inspect
|
|
73
|
+
[2]: https://versionbadg.es/inspect-js/object-inspect.svg
|
|
74
|
+
[5]: https://david-dm.org/inspect-js/object-inspect.svg
|
|
75
|
+
[6]: https://david-dm.org/inspect-js/object-inspect
|
|
76
|
+
[7]: https://david-dm.org/inspect-js/object-inspect/dev-status.svg
|
|
77
|
+
[8]: https://david-dm.org/inspect-js/object-inspect#info=devDependencies
|
|
78
|
+
[11]: https://nodei.co/npm/object-inspect.png?downloads=true&stars=true
|
|
79
|
+
[license-image]: https://img.shields.io/npm/l/object-inspect.svg
|
|
80
|
+
[license-url]: LICENSE
|
|
81
|
+
[downloads-image]: https://img.shields.io/npm/dm/object-inspect.svg
|
|
82
|
+
[downloads-url]: https://npm-stat.com/charts.html?package=object-inspect
|
|
83
|
+
[codecov-image]: https://codecov.io/gh/inspect-js/object-inspect/branch/main/graphs/badge.svg
|
|
84
|
+
[codecov-url]: https://app.codecov.io/gh/inspect-js/object-inspect/
|
|
85
|
+
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/inspect-js/object-inspect
|
|
86
|
+
[actions-url]: https://github.com/inspect-js/object-inspect/actions
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var inspect = require('../');
|
|
4
|
+
var test = require('tape');
|
|
5
|
+
var hasToStringTag = require('has-tostringtag/shams')();
|
|
6
|
+
|
|
7
|
+
test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
|
|
8
|
+
t.test('primitives', function (st) {
|
|
9
|
+
st.plan(3);
|
|
10
|
+
|
|
11
|
+
st.equal(inspect(BigInt(-256)), '-256n');
|
|
12
|
+
st.equal(inspect(BigInt(0)), '0n');
|
|
13
|
+
st.equal(inspect(BigInt(256)), '256n');
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
t.test('objects', function (st) {
|
|
17
|
+
st.plan(3);
|
|
18
|
+
|
|
19
|
+
st.equal(inspect(Object(BigInt(-256))), 'Object(-256n)');
|
|
20
|
+
st.equal(inspect(Object(BigInt(0))), 'Object(0n)');
|
|
21
|
+
st.equal(inspect(Object(BigInt(256))), 'Object(256n)');
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
t.test('syntactic primitives', function (st) {
|
|
25
|
+
st.plan(3);
|
|
26
|
+
|
|
27
|
+
/* eslint-disable no-new-func */
|
|
28
|
+
st.equal(inspect(Function('return -256n')()), '-256n');
|
|
29
|
+
st.equal(inspect(Function('return 0n')()), '0n');
|
|
30
|
+
st.equal(inspect(Function('return 256n')()), '256n');
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
t.test('toStringTag', { skip: !hasToStringTag }, function (st) {
|
|
34
|
+
st.plan(1);
|
|
35
|
+
|
|
36
|
+
var faker = {};
|
|
37
|
+
faker[Symbol.toStringTag] = 'BigInt';
|
|
38
|
+
st.equal(
|
|
39
|
+
inspect(faker),
|
|
40
|
+
'{ [Symbol(Symbol.toStringTag)]: \'BigInt\' }',
|
|
41
|
+
'object lying about being a BigInt inspects as an object'
|
|
42
|
+
);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
t.test('numericSeparator', function (st) {
|
|
46
|
+
st.equal(inspect(BigInt(0), { numericSeparator: false }), '0n', '0n, numericSeparator false');
|
|
47
|
+
st.equal(inspect(BigInt(0), { numericSeparator: true }), '0n', '0n, numericSeparator true');
|
|
48
|
+
|
|
49
|
+
st.equal(inspect(BigInt(1234), { numericSeparator: false }), '1234n', '1234n, numericSeparator false');
|
|
50
|
+
st.equal(inspect(BigInt(1234), { numericSeparator: true }), '1_234n', '1234n, numericSeparator true');
|
|
51
|
+
st.equal(inspect(BigInt(-1234), { numericSeparator: false }), '-1234n', '1234n, numericSeparator false');
|
|
52
|
+
st.equal(inspect(BigInt(-1234), { numericSeparator: true }), '-1_234n', '1234n, numericSeparator true');
|
|
53
|
+
|
|
54
|
+
st.end();
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
t.end();
|
|
58
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var inspect = require('../../');
|
|
2
|
+
var test = require('tape');
|
|
3
|
+
|
|
4
|
+
test('dom element', function (t) {
|
|
5
|
+
t.plan(1);
|
|
6
|
+
|
|
7
|
+
var d = document.createElement('div');
|
|
8
|
+
d.setAttribute('id', 'beep');
|
|
9
|
+
d.innerHTML = '<b>wooo</b><i>iiiii</i>';
|
|
10
|
+
|
|
11
|
+
t.equal(
|
|
12
|
+
inspect([d, { a: 3, b: 4, c: [5, 6, [7, [8, [9]]]] }]),
|
|
13
|
+
'[ <div id="beep">...</div>, { a: 3, b: 4, c: [ 5, 6, [ 7, [ 8, [Object] ] ] ] } ]'
|
|
14
|
+
);
|
|
15
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
var inspect = require('../');
|
|
2
|
+
var test = require('tape');
|
|
3
|
+
|
|
4
|
+
test('circular', function (t) {
|
|
5
|
+
t.plan(2);
|
|
6
|
+
var obj = { a: 1, b: [3, 4] };
|
|
7
|
+
obj.c = obj;
|
|
8
|
+
t.equal(inspect(obj), '{ a: 1, b: [ 3, 4 ], c: [Circular] }');
|
|
9
|
+
|
|
10
|
+
var double = {};
|
|
11
|
+
double.a = [double];
|
|
12
|
+
double.b = {};
|
|
13
|
+
double.b.inner = double.b;
|
|
14
|
+
double.b.obj = double;
|
|
15
|
+
t.equal(inspect(double), '{ a: [ [Circular] ], b: { inner: [Circular], obj: [Circular] } }');
|
|
16
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
var inspect = require('../');
|
|
2
|
+
var test = require('tape');
|
|
3
|
+
|
|
4
|
+
test('deep', function (t) {
|
|
5
|
+
t.plan(4);
|
|
6
|
+
var obj = [[[[[[500]]]]]];
|
|
7
|
+
t.equal(inspect(obj), '[ [ [ [ [ [Array] ] ] ] ] ]');
|
|
8
|
+
t.equal(inspect(obj, { depth: 4 }), '[ [ [ [ [Array] ] ] ] ]');
|
|
9
|
+
t.equal(inspect(obj, { depth: 2 }), '[ [ [Array] ] ]');
|
|
10
|
+
|
|
11
|
+
t.equal(inspect([[[{ a: 1 }]]], { depth: 3 }), '[ [ [ [Object] ] ] ]');
|
|
12
|
+
});
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
var inspect = require('../');
|
|
2
|
+
var test = require('tape');
|
|
3
|
+
|
|
4
|
+
test('element', function (t) {
|
|
5
|
+
t.plan(3);
|
|
6
|
+
var elem = {
|
|
7
|
+
nodeName: 'div',
|
|
8
|
+
attributes: [{ name: 'class', value: 'row' }],
|
|
9
|
+
getAttribute: function (key) { return key; },
|
|
10
|
+
childNodes: []
|
|
11
|
+
};
|
|
12
|
+
var obj = [1, elem, 3];
|
|
13
|
+
t.deepEqual(inspect(obj), '[ 1, <div class="row"></div>, 3 ]');
|
|
14
|
+
t.deepEqual(inspect(obj, { quoteStyle: 'single' }), "[ 1, <div class='row'></div>, 3 ]");
|
|
15
|
+
t.deepEqual(inspect(obj, { quoteStyle: 'double' }), '[ 1, <div class="row"></div>, 3 ]');
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
test('element no attr', function (t) {
|
|
19
|
+
t.plan(1);
|
|
20
|
+
var elem = {
|
|
21
|
+
nodeName: 'div',
|
|
22
|
+
getAttribute: function (key) { return key; },
|
|
23
|
+
childNodes: []
|
|
24
|
+
};
|
|
25
|
+
var obj = [1, elem, 3];
|
|
26
|
+
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
test('element with contents', function (t) {
|
|
30
|
+
t.plan(1);
|
|
31
|
+
var elem = {
|
|
32
|
+
nodeName: 'div',
|
|
33
|
+
getAttribute: function (key) { return key; },
|
|
34
|
+
childNodes: [{ nodeName: 'b' }]
|
|
35
|
+
};
|
|
36
|
+
var obj = [1, elem, 3];
|
|
37
|
+
t.deepEqual(inspect(obj), '[ 1, <div>...</div>, 3 ]');
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('element instance', function (t) {
|
|
41
|
+
t.plan(1);
|
|
42
|
+
var h = global.HTMLElement;
|
|
43
|
+
global.HTMLElement = function (name, attr) {
|
|
44
|
+
this.nodeName = name;
|
|
45
|
+
this.attributes = attr;
|
|
46
|
+
};
|
|
47
|
+
global.HTMLElement.prototype.getAttribute = function () {};
|
|
48
|
+
|
|
49
|
+
var elem = new global.HTMLElement('div', []);
|
|
50
|
+
var obj = [1, elem, 3];
|
|
51
|
+
t.deepEqual(inspect(obj), '[ 1, <div></div>, 3 ]');
|
|
52
|
+
global.HTMLElement = h;
|
|
53
|
+
});
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
var test = require('tape');
|
|
2
|
+
var ErrorWithCause = require('error-cause/Error');
|
|
3
|
+
|
|
4
|
+
var inspect = require('../');
|
|
5
|
+
|
|
6
|
+
test('type error', function (t) {
|
|
7
|
+
t.plan(1);
|
|
8
|
+
var aerr = new TypeError();
|
|
9
|
+
aerr.foo = 555;
|
|
10
|
+
aerr.bar = [1, 2, 3];
|
|
11
|
+
|
|
12
|
+
var berr = new TypeError('tuv');
|
|
13
|
+
berr.baz = 555;
|
|
14
|
+
|
|
15
|
+
var cerr = new SyntaxError();
|
|
16
|
+
cerr.message = 'whoa';
|
|
17
|
+
cerr['a-b'] = 5;
|
|
18
|
+
|
|
19
|
+
var withCause = new ErrorWithCause('foo', { cause: 'bar' });
|
|
20
|
+
var withCausePlus = new ErrorWithCause('foo', { cause: 'bar' });
|
|
21
|
+
withCausePlus.foo = 'bar';
|
|
22
|
+
var withUndefinedCause = new ErrorWithCause('foo', { cause: undefined });
|
|
23
|
+
var withEnumerableCause = new Error('foo');
|
|
24
|
+
withEnumerableCause.cause = 'bar';
|
|
25
|
+
|
|
26
|
+
var obj = [
|
|
27
|
+
new TypeError(),
|
|
28
|
+
new TypeError('xxx'),
|
|
29
|
+
aerr,
|
|
30
|
+
berr,
|
|
31
|
+
cerr,
|
|
32
|
+
withCause,
|
|
33
|
+
withCausePlus,
|
|
34
|
+
withUndefinedCause,
|
|
35
|
+
withEnumerableCause
|
|
36
|
+
];
|
|
37
|
+
t.equal(inspect(obj), '[ ' + [
|
|
38
|
+
'[TypeError]',
|
|
39
|
+
'[TypeError: xxx]',
|
|
40
|
+
'{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }',
|
|
41
|
+
'{ [TypeError: tuv] baz: 555 }',
|
|
42
|
+
'{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }',
|
|
43
|
+
'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: \'bar\' }',
|
|
44
|
+
'{ [Error: foo] ' + ('cause' in Error.prototype ? '' : '[cause]: \'bar\', ') + 'foo: \'bar\' }',
|
|
45
|
+
'cause' in Error.prototype ? '[Error: foo]' : '{ [Error: foo] [cause]: undefined }',
|
|
46
|
+
'{ [Error: foo] cause: \'bar\' }'
|
|
47
|
+
].join(', ') + ' ]');
|
|
48
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var inspect = require('../');
|
|
4
|
+
var test = require('tape');
|
|
5
|
+
var hasToStringTag = require('has-tostringtag/shams')();
|
|
6
|
+
var forEach = require('for-each');
|
|
7
|
+
|
|
8
|
+
test('fakes', { skip: !hasToStringTag }, function (t) {
|
|
9
|
+
forEach([
|
|
10
|
+
'Array',
|
|
11
|
+
'Boolean',
|
|
12
|
+
'Date',
|
|
13
|
+
'Error',
|
|
14
|
+
'Number',
|
|
15
|
+
'RegExp',
|
|
16
|
+
'String'
|
|
17
|
+
], function (expected) {
|
|
18
|
+
var faker = {};
|
|
19
|
+
faker[Symbol.toStringTag] = expected;
|
|
20
|
+
|
|
21
|
+
t.equal(
|
|
22
|
+
inspect(faker),
|
|
23
|
+
'{ [Symbol(Symbol.toStringTag)]: \'' + expected + '\' }',
|
|
24
|
+
'faker masquerading as ' + expected + ' is not shown as one'
|
|
25
|
+
);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
t.end();
|
|
29
|
+
});
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var inspect = require('../');
|
|
2
|
+
var test = require('tape');
|
|
3
|
+
var arrow = require('make-arrow-function')();
|
|
4
|
+
var functionsHaveConfigurableNames = require('functions-have-names').functionsHaveConfigurableNames();
|
|
5
|
+
|
|
6
|
+
test('function', function (t) {
|
|
7
|
+
t.plan(1);
|
|
8
|
+
var obj = [1, 2, function f(n) { return n; }, 4];
|
|
9
|
+
t.equal(inspect(obj), '[ 1, 2, [Function: f], 4 ]');
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test('function name', function (t) {
|
|
13
|
+
t.plan(1);
|
|
14
|
+
var f = (function () {
|
|
15
|
+
return function () {};
|
|
16
|
+
}());
|
|
17
|
+
f.toString = function toStr() { return 'function xxx () {}'; };
|
|
18
|
+
var obj = [1, 2, f, 4];
|
|
19
|
+
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)] { toString: [Function: toStr] }, 4 ]');
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test('anon function', function (t) {
|
|
23
|
+
var f = (function () {
|
|
24
|
+
return function () {};
|
|
25
|
+
}());
|
|
26
|
+
var obj = [1, 2, f, 4];
|
|
27
|
+
t.equal(inspect(obj), '[ 1, 2, [Function (anonymous)], 4 ]');
|
|
28
|
+
|
|
29
|
+
t.end();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
test('arrow function', { skip: !arrow }, function (t) {
|
|
33
|
+
t.equal(inspect(arrow), '[Function (anonymous)]');
|
|
34
|
+
|
|
35
|
+
t.end();
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
test('truly nameless function', { skip: !arrow || !functionsHaveConfigurableNames }, function (t) {
|
|
39
|
+
function f() {}
|
|
40
|
+
Object.defineProperty(f, 'name', { value: false });
|
|
41
|
+
t.equal(f.name, false);
|
|
42
|
+
t.equal(
|
|
43
|
+
inspect(f),
|
|
44
|
+
'[Function: f]',
|
|
45
|
+
'named function with falsy `.name` does not hide its original name'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
function g() {}
|
|
49
|
+
Object.defineProperty(g, 'name', { value: true });
|
|
50
|
+
t.equal(g.name, true);
|
|
51
|
+
t.equal(
|
|
52
|
+
inspect(g),
|
|
53
|
+
'[Function: true]',
|
|
54
|
+
'named function with truthy `.name` hides its original name'
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
var anon = function () {}; // eslint-disable-line func-style
|
|
58
|
+
Object.defineProperty(anon, 'name', { value: null });
|
|
59
|
+
t.equal(anon.name, null);
|
|
60
|
+
t.equal(
|
|
61
|
+
inspect(anon),
|
|
62
|
+
'[Function (anonymous)]',
|
|
63
|
+
'anon function with falsy `.name` does not hide its anonymity'
|
|
64
|
+
);
|
|
65
|
+
|
|
66
|
+
var anon2 = function () {}; // eslint-disable-line func-style
|
|
67
|
+
Object.defineProperty(anon2, 'name', { value: 1 });
|
|
68
|
+
t.equal(anon2.name, 1);
|
|
69
|
+
t.equal(
|
|
70
|
+
inspect(anon2),
|
|
71
|
+
'[Function: 1]',
|
|
72
|
+
'anon function with truthy `.name` hides its anonymity'
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
t.end();
|
|
76
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var inspect = require('../');
|
|
4
|
+
var test = require('tape');
|
|
5
|
+
var mockProperty = require('mock-property');
|
|
6
|
+
|
|
7
|
+
test('when Object#hasOwnProperty is deleted', function (t) {
|
|
8
|
+
t.plan(1);
|
|
9
|
+
var arr = [1, , 3]; // eslint-disable-line no-sparse-arrays
|
|
10
|
+
|
|
11
|
+
t.teardown(mockProperty(Array.prototype, 1, { value: 2 })); // this is needed to account for "in" vs "hasOwnProperty"
|
|
12
|
+
t.teardown(mockProperty(Object.prototype, 'hasOwnProperty', { 'delete': true }));
|
|
13
|
+
|
|
14
|
+
t.equal(inspect(arr), '[ 1, , 3 ]');
|
|
15
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
var test = require('tape');
|
|
2
|
+
var inspect = require('../');
|
|
3
|
+
|
|
4
|
+
var xs = ['a', 'b'];
|
|
5
|
+
xs[5] = 'f';
|
|
6
|
+
xs[7] = 'j';
|
|
7
|
+
xs[8] = 'k';
|
|
8
|
+
|
|
9
|
+
test('holes', function (t) {
|
|
10
|
+
t.plan(1);
|
|
11
|
+
t.equal(
|
|
12
|
+
inspect(xs),
|
|
13
|
+
"[ 'a', 'b', , , , 'f', , 'j', 'k' ]"
|
|
14
|
+
);
|
|
15
|
+
});
|