cdk-common 2.0.7 → 2.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.jsii +15 -3
- package/API.md +10 -0
- package/lib/main.js +1 -1
- package/lib/managed-policies.d.ts +8 -0
- package/lib/managed-policies.js +3 -1
- package/node_modules/@aws-cdk/assert/package.json +9 -9
- package/node_modules/@aws-cdk/cfnspec/CHANGELOG.md +249 -0
- package/node_modules/@aws-cdk/cfnspec/build-tools/create-missing-libraries.js +2 -2
- package/node_modules/@aws-cdk/cfnspec/cfn.version +1 -1
- package/node_modules/@aws-cdk/cfnspec/coverage/block-navigation.js +8 -0
- package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/massage-spec.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/build-tools/scrutiny.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/junit.xml +7375 -6125
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/block-navigation.js +8 -0
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/massage-spec.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/build-tools/scrutiny.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/canned-metrics-schema.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/canned-metrics.ts.html +30 -24
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/index.ts.html +25 -19
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/augmentation.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/base-types.ts.html +10 -4
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/index.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/property.ts.html +20 -14
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/resource-type.ts.html +10 -4
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/lib/schema/specification.ts.html +9 -3
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov-report/sorter.js +26 -0
- package/node_modules/@aws-cdk/cfnspec/coverage/lcov.info +121 -121
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/canned-metrics-schema.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/canned-metrics.ts.html +30 -24
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/index.ts.html +25 -19
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/augmentation.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/base-types.ts.html +10 -4
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/index.ts.html +8 -2
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/property.ts.html +20 -14
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/resource-type.ts.html +10 -4
- package/node_modules/@aws-cdk/cfnspec/coverage/lib/schema/specification.ts.html +9 -3
- package/node_modules/@aws-cdk/cfnspec/coverage/sorter.js +26 -0
- package/node_modules/@aws-cdk/cfnspec/package.json +4 -4
- package/node_modules/@aws-cdk/cfnspec/spec/specification.json +4474 -46
- package/node_modules/@aws-cdk/cfnspec/tsconfig.tsbuildinfo +35 -33
- package/node_modules/@aws-cdk/cloudformation-diff/package.json +8 -8
- package/node_modules/@types/concat-stream/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/async_hooks.d.ts +7 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/buffer.d.ts +9 -9
- package/node_modules/@types/concat-stream/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/cluster.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/console.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/dgram.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns/promises.d.ts +12 -10
- package/node_modules/@types/concat-stream/node_modules/@types/node/dns.d.ts +17 -12
- package/node_modules/@types/concat-stream/node_modules/@types/node/domain.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs/promises.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/fs.d.ts +62 -11
- package/node_modules/@types/concat-stream/node_modules/@types/node/http.d.ts +20 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/http2.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/https.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/inspector.d.ts +4 -5
- package/node_modules/@types/concat-stream/node_modules/@types/node/net.d.ts +11 -11
- package/node_modules/@types/concat-stream/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/perf_hooks.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/readline.d.ts +121 -14
- package/node_modules/@types/concat-stream/node_modules/@types/node/repl.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream/web.d.ts +3 -65
- package/node_modules/@types/concat-stream/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/concat-stream/node_modules/@types/node/string_decoder.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/tls.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/trace_events.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/url.d.ts +58 -18
- package/node_modules/@types/concat-stream/node_modules/@types/node/util.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/v8.d.ts +3 -3
- package/node_modules/@types/concat-stream/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/concat-stream/node_modules/@types/node/worker_threads.d.ts +4 -4
- package/node_modules/@types/concat-stream/node_modules/@types/node/zlib.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/assert.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/async_hooks.d.ts +7 -3
- package/node_modules/@types/form-data/node_modules/@types/node/buffer.d.ts +9 -9
- package/node_modules/@types/form-data/node_modules/@types/node/child_process.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/cluster.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/console.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/dgram.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/diagnostics_channel.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/dns/promises.d.ts +12 -10
- package/node_modules/@types/form-data/node_modules/@types/node/dns.d.ts +17 -12
- package/node_modules/@types/form-data/node_modules/@types/node/domain.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/events.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/fs/promises.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/fs.d.ts +62 -11
- package/node_modules/@types/form-data/node_modules/@types/node/http.d.ts +20 -3
- package/node_modules/@types/form-data/node_modules/@types/node/http2.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/https.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/index.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/inspector.d.ts +4 -5
- package/node_modules/@types/form-data/node_modules/@types/node/net.d.ts +11 -11
- package/node_modules/@types/form-data/node_modules/@types/node/os.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/path.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/perf_hooks.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/punycode.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/querystring.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/readline.d.ts +121 -14
- package/node_modules/@types/form-data/node_modules/@types/node/repl.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/stream/web.d.ts +3 -65
- package/node_modules/@types/form-data/node_modules/@types/node/stream.d.ts +2 -2
- package/node_modules/@types/form-data/node_modules/@types/node/string_decoder.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/timers.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/tls.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/trace_events.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/tty.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/url.d.ts +58 -18
- package/node_modules/@types/form-data/node_modules/@types/node/util.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/v8.d.ts +3 -3
- package/node_modules/@types/form-data/node_modules/@types/node/vm.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/wasi.d.ts +1 -1
- package/node_modules/@types/form-data/node_modules/@types/node/worker_threads.d.ts +4 -4
- package/node_modules/@types/form-data/node_modules/@types/node/zlib.d.ts +1 -1
- package/node_modules/object-inspect/CHANGELOG.md +11 -0
- package/node_modules/object-inspect/index.js +64 -24
- package/node_modules/object-inspect/package.json +5 -3
- package/node_modules/object-inspect/readme.markdown +1 -0
- package/node_modules/object-inspect/test/bigint.js +12 -0
- package/node_modules/object-inspect/test/err.js +20 -3
- package/node_modules/object-inspect/test/number.js +47 -1
- package/package.json +4 -4
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* ```js
|
|
6
6
|
* import url from 'url';
|
|
7
7
|
* ```
|
|
8
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
8
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/url.js)
|
|
9
9
|
*/
|
|
10
10
|
declare module 'url' {
|
|
11
11
|
import { Blob } from 'node:buffer';
|
|
@@ -72,27 +72,67 @@ declare module 'url' {
|
|
|
72
72
|
function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery;
|
|
73
73
|
function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url;
|
|
74
74
|
/**
|
|
75
|
-
* The
|
|
76
|
-
* These are not, however, customizable in any way. The `url.format(URL[, options])` method allows for basic
|
|
77
|
-
* customization of the output.
|
|
78
|
-
* Returns a customizable serialization of a URL `String` representation of a `WHATWG URL` object.
|
|
75
|
+
* The `url.format()` method returns a formatted URL string derived from`urlObject`.
|
|
79
76
|
*
|
|
80
77
|
* ```js
|
|
81
|
-
*
|
|
82
|
-
*
|
|
78
|
+
* const url = require('url');
|
|
79
|
+
* url.format({
|
|
80
|
+
* protocol: 'https',
|
|
81
|
+
* hostname: 'example.com',
|
|
82
|
+
* pathname: '/some/path',
|
|
83
|
+
* query: {
|
|
84
|
+
* page: 1,
|
|
85
|
+
* format: 'json'
|
|
86
|
+
* }
|
|
87
|
+
* });
|
|
83
88
|
*
|
|
84
|
-
*
|
|
85
|
-
*
|
|
89
|
+
* // => 'https://example.com/some/path?page=1&format=json'
|
|
90
|
+
* ```
|
|
86
91
|
*
|
|
87
|
-
*
|
|
88
|
-
* // Prints https://a:b@xn--g6w251d/?abc#foo
|
|
92
|
+
* If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`.
|
|
89
93
|
*
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
94
|
+
* The formatting process operates as follows:
|
|
95
|
+
*
|
|
96
|
+
* * A new empty string `result` is created.
|
|
97
|
+
* * If `urlObject.protocol` is a string, it is appended as-is to `result`.
|
|
98
|
+
* * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown.
|
|
99
|
+
* * For all string values of `urlObject.protocol` that _do not end_ with an ASCII
|
|
100
|
+
* colon (`:`) character, the literal string `:` will be appended to `result`.
|
|
101
|
+
* * If either of the following conditions is true, then the literal string `//`will be appended to `result`:
|
|
102
|
+
* * `urlObject.slashes` property is true;
|
|
103
|
+
* * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`;
|
|
104
|
+
* * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string
|
|
105
|
+
* and appended to `result`followed by the literal string `@`.
|
|
106
|
+
* * If the `urlObject.host` property is `undefined` then:
|
|
107
|
+
* * If the `urlObject.hostname` is a string, it is appended to `result`.
|
|
108
|
+
* * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string,
|
|
109
|
+
* an `Error` is thrown.
|
|
110
|
+
* * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`:
|
|
111
|
+
* * The literal string `:` is appended to `result`, and
|
|
112
|
+
* * The value of `urlObject.port` is coerced to a string and appended to`result`.
|
|
113
|
+
* * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`.
|
|
114
|
+
* * If the `urlObject.pathname` property is a string that is not an empty string:
|
|
115
|
+
* * If the `urlObject.pathname`_does not start_ with an ASCII forward slash
|
|
116
|
+
* (`/`), then the literal string `'/'` is appended to `result`.
|
|
117
|
+
* * The value of `urlObject.pathname` is appended to `result`.
|
|
118
|
+
* * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown.
|
|
119
|
+
* * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the
|
|
120
|
+
* `querystring` module's `stringify()`method passing the value of `urlObject.query`.
|
|
121
|
+
* * Otherwise, if `urlObject.search` is a string:
|
|
122
|
+
* * If the value of `urlObject.search`_does not start_ with the ASCII question
|
|
123
|
+
* mark (`?`) character, the literal string `?` is appended to `result`.
|
|
124
|
+
* * The value of `urlObject.search` is appended to `result`.
|
|
125
|
+
* * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown.
|
|
126
|
+
* * If the `urlObject.hash` property is a string:
|
|
127
|
+
* * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`)
|
|
128
|
+
* character, the literal string `#` is appended to `result`.
|
|
129
|
+
* * The value of `urlObject.hash` is appended to `result`.
|
|
130
|
+
* * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a
|
|
131
|
+
* string, an `Error` is thrown.
|
|
132
|
+
* * `result` is returned.
|
|
133
|
+
* @since v0.1.25
|
|
134
|
+
* @deprecated Legacy: Use the WHATWG URL API instead.
|
|
135
|
+
* @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`.
|
|
96
136
|
*/
|
|
97
137
|
function format(urlObject: URL, options?: URLFormatOptions): string;
|
|
98
138
|
/**
|
|
@@ -301,7 +341,7 @@ declare module 'url' {
|
|
|
301
341
|
* }
|
|
302
342
|
*
|
|
303
343
|
* ```
|
|
304
|
-
* @since v15.7.0
|
|
344
|
+
* @since v15.7.0, v14.18.0
|
|
305
345
|
* @param url The `WHATWG URL` object to convert to an options object.
|
|
306
346
|
* @return Options object
|
|
307
347
|
*/
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* ```js
|
|
7
7
|
* const util = require('util');
|
|
8
8
|
* ```
|
|
9
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
9
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/util.js)
|
|
10
10
|
*/
|
|
11
11
|
declare module 'util' {
|
|
12
12
|
import * as types from 'node:util/types';
|
|
@@ -139,7 +139,7 @@ declare module 'util' {
|
|
|
139
139
|
* console.error(name); // ENOENT
|
|
140
140
|
* });
|
|
141
141
|
* ```
|
|
142
|
-
* @since v16.0.0
|
|
142
|
+
* @since v16.0.0, v14.17.0
|
|
143
143
|
*/
|
|
144
144
|
export function getSystemErrorMap(): Map<number, [string, string]>;
|
|
145
145
|
/**
|
|
@@ -159,7 +159,7 @@ declare module 'util' {
|
|
|
159
159
|
* Returns the `string` after replacing any surrogate code points
|
|
160
160
|
* (or equivalently, any unpaired surrogate code units) with the
|
|
161
161
|
* Unicode "replacement character" U+FFFD.
|
|
162
|
-
* @since v16.8.0
|
|
162
|
+
* @since v16.8.0, v14.18.0
|
|
163
163
|
*/
|
|
164
164
|
export function toUSVString(string: string): string;
|
|
165
165
|
/**
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* ```js
|
|
5
5
|
* const v8 = require('v8');
|
|
6
6
|
* ```
|
|
7
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
7
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/v8.js)
|
|
8
8
|
*/
|
|
9
9
|
declare module 'v8' {
|
|
10
10
|
import { Readable } from 'node:stream';
|
|
@@ -362,14 +362,14 @@ declare module 'v8' {
|
|
|
362
362
|
*
|
|
363
363
|
* When the process is about to exit, one last coverage will still be written to
|
|
364
364
|
* disk unless {@link stopCoverage} is invoked before the process exits.
|
|
365
|
-
* @since v15.1.0, v12.22.0
|
|
365
|
+
* @since v15.1.0, v14.18.0, v12.22.0
|
|
366
366
|
*/
|
|
367
367
|
function takeCoverage(): void;
|
|
368
368
|
/**
|
|
369
369
|
* The `v8.stopCoverage()` method allows the user to stop the coverage collection
|
|
370
370
|
* started by `NODE_V8_COVERAGE`, so that V8 can release the execution count
|
|
371
371
|
* records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand.
|
|
372
|
-
* @since v15.1.0, v12.22.0
|
|
372
|
+
* @since v15.1.0, v14.18.0, v12.22.0
|
|
373
373
|
*/
|
|
374
374
|
function stopCoverage(): void;
|
|
375
375
|
}
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
*
|
|
33
33
|
* console.log(x); // 1; y is not defined.
|
|
34
34
|
* ```
|
|
35
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
35
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/vm.js)
|
|
36
36
|
*/
|
|
37
37
|
declare module 'vm' {
|
|
38
38
|
interface Context extends NodeJS.Dict<any> {}
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
* The `--experimental-wasi-unstable-preview1` CLI argument is needed for this
|
|
69
69
|
* example to run.
|
|
70
70
|
* @experimental
|
|
71
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
71
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/wasi.js)
|
|
72
72
|
*/
|
|
73
73
|
declare module 'wasi' {
|
|
74
74
|
interface WASIOptions {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
*
|
|
50
50
|
* Worker threads inherit non-process-specific options by default. Refer to `Worker constructor options` to know how to customize worker thread options,
|
|
51
51
|
* specifically `argv` and `execArgv` options.
|
|
52
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
52
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/worker_threads.js)
|
|
53
53
|
*/
|
|
54
54
|
declare module 'worker_threads' {
|
|
55
55
|
import { Blob } from 'node:buffer';
|
|
@@ -384,7 +384,7 @@ declare module 'worker_threads' {
|
|
|
384
384
|
/**
|
|
385
385
|
* An object that can be used to query performance information from a worker
|
|
386
386
|
* instance. Similar to `perf_hooks.performance`.
|
|
387
|
-
* @since v15.1.0, v12.22.0
|
|
387
|
+
* @since v15.1.0, v14.17.0, v12.22.0
|
|
388
388
|
*/
|
|
389
389
|
readonly performance: WorkerPerformance;
|
|
390
390
|
/**
|
|
@@ -629,14 +629,14 @@ declare module 'worker_threads' {
|
|
|
629
629
|
* console.log(getEnvironmentData('Hello')); // Prints 'World!'.
|
|
630
630
|
* }
|
|
631
631
|
* ```
|
|
632
|
-
* @since v15.12.0
|
|
632
|
+
* @since v15.12.0, v14.18.0
|
|
633
633
|
* @experimental
|
|
634
634
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
635
635
|
*/
|
|
636
636
|
function getEnvironmentData(key: Serializable): Serializable;
|
|
637
637
|
/**
|
|
638
638
|
* The `worker.setEnvironmentData()` API sets the content of`worker.getEnvironmentData()` in the current thread and all new `Worker`instances spawned from the current context.
|
|
639
|
-
* @since v15.12.0
|
|
639
|
+
* @since v15.12.0, v14.18.0
|
|
640
640
|
* @experimental
|
|
641
641
|
* @param key Any arbitrary, cloneable JavaScript value that can be used as a {Map} key.
|
|
642
642
|
* @param value Any arbitrary, cloneable JavaScript value that will be cloned and passed automatically to all new `Worker` instances. If `value` is passed as `undefined`, any previously set value
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
* });
|
|
89
89
|
* ```
|
|
90
90
|
* @since v0.5.8
|
|
91
|
-
* @see [source](https://github.com/nodejs/node/blob/
|
|
91
|
+
* @see [source](https://github.com/nodejs/node/blob/v17.0.0/lib/zlib.js)
|
|
92
92
|
*/
|
|
93
93
|
declare module 'zlib' {
|
|
94
94
|
import * as stream from 'node:stream';
|
|
@@ -5,6 +5,17 @@ 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.12.0](https://github.com/inspect-js/object-inspect/compare/v1.11.1...v1.12.0) - 2021-12-18
|
|
9
|
+
|
|
10
|
+
### Commits
|
|
11
|
+
|
|
12
|
+
- [New] add `numericSeparator` boolean option [`2d2d537`](https://github.com/inspect-js/object-inspect/commit/2d2d537f5359a4300ce1c10241369f8024f89e11)
|
|
13
|
+
- [Robustness] cache more prototype methods [`191533d`](https://github.com/inspect-js/object-inspect/commit/191533da8aec98a05eadd73a5a6e979c9c8653e8)
|
|
14
|
+
- [New] ensure an Error’s `cause` is displayed [`53bc2ce`](https://github.com/inspect-js/object-inspect/commit/53bc2cee4e5a9cc4986f3cafa22c0685f340715e)
|
|
15
|
+
- [Dev Deps] update `eslint`, `@ljharb/eslint-config` [`bc164b6`](https://github.com/inspect-js/object-inspect/commit/bc164b6e2e7d36b263970f16f54de63048b84a36)
|
|
16
|
+
- [Robustness] cache `RegExp.prototype.test` [`a314ab8`](https://github.com/inspect-js/object-inspect/commit/a314ab8271b905cbabc594c82914d2485a8daf12)
|
|
17
|
+
- [meta] fix auto-changelog settings [`5ed0983`](https://github.com/inspect-js/object-inspect/commit/5ed0983be72f73e32e2559997517a95525c7e20d)
|
|
18
|
+
|
|
8
19
|
## [v1.11.1](https://github.com/inspect-js/object-inspect/compare/v1.11.0...v1.11.1) - 2021-12-05
|
|
9
20
|
|
|
10
21
|
### Commits
|
|
@@ -15,7 +15,16 @@ var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
|
|
|
15
15
|
var booleanValueOf = Boolean.prototype.valueOf;
|
|
16
16
|
var objectToString = Object.prototype.toString;
|
|
17
17
|
var functionToString = Function.prototype.toString;
|
|
18
|
-
var match = String.prototype.match;
|
|
18
|
+
var $match = String.prototype.match;
|
|
19
|
+
var $slice = String.prototype.slice;
|
|
20
|
+
var $replace = String.prototype.replace;
|
|
21
|
+
var $toUpperCase = String.prototype.toUpperCase;
|
|
22
|
+
var $toLowerCase = String.prototype.toLowerCase;
|
|
23
|
+
var $test = RegExp.prototype.test;
|
|
24
|
+
var $concat = Array.prototype.concat;
|
|
25
|
+
var $join = Array.prototype.join;
|
|
26
|
+
var $arrSlice = Array.prototype.slice;
|
|
27
|
+
var $floor = Math.floor;
|
|
19
28
|
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
|
|
20
29
|
var gOPS = Object.getOwnPropertySymbols;
|
|
21
30
|
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
|
|
@@ -34,6 +43,28 @@ var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPr
|
|
|
34
43
|
: null
|
|
35
44
|
);
|
|
36
45
|
|
|
46
|
+
function addNumericSeparator(num, str) {
|
|
47
|
+
if (
|
|
48
|
+
num === Infinity
|
|
49
|
+
|| num === -Infinity
|
|
50
|
+
|| num !== num
|
|
51
|
+
|| (num && num > -1000 && num < 1000)
|
|
52
|
+
|| $test.call(/e/, str)
|
|
53
|
+
) {
|
|
54
|
+
return str;
|
|
55
|
+
}
|
|
56
|
+
var sepRegex = /[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;
|
|
57
|
+
if (typeof num === 'number') {
|
|
58
|
+
var int = num < 0 ? -$floor(-num) : $floor(num); // trunc(num)
|
|
59
|
+
if (int !== num) {
|
|
60
|
+
var intStr = String(int);
|
|
61
|
+
var dec = $slice.call(str, intStr.length + 1);
|
|
62
|
+
return $replace.call(intStr, sepRegex, '$&_') + '.' + $replace.call($replace.call(dec, /([0-9]{3})/g, '$&_'), /_$/, '');
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return $replace.call(str, sepRegex, '$&_');
|
|
66
|
+
}
|
|
67
|
+
|
|
37
68
|
var inspectCustom = require('./util.inspect').custom;
|
|
38
69
|
var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
|
|
39
70
|
|
|
@@ -62,8 +93,12 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
62
93
|
&& opts.indent !== '\t'
|
|
63
94
|
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
|
|
64
95
|
) {
|
|
65
|
-
throw new TypeError('
|
|
96
|
+
throw new TypeError('option "indent" must be "\\t", an integer > 0, or `null`');
|
|
66
97
|
}
|
|
98
|
+
if (has(opts, 'numericSeparator') && typeof opts.numericSeparator !== 'boolean') {
|
|
99
|
+
throw new TypeError('option "numericSeparator", if provided, must be `true` or `false`');
|
|
100
|
+
}
|
|
101
|
+
var numericSeparator = opts.numericSeparator;
|
|
67
102
|
|
|
68
103
|
if (typeof obj === 'undefined') {
|
|
69
104
|
return 'undefined';
|
|
@@ -82,10 +117,12 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
82
117
|
if (obj === 0) {
|
|
83
118
|
return Infinity / obj > 0 ? '0' : '-0';
|
|
84
119
|
}
|
|
85
|
-
|
|
120
|
+
var str = String(obj);
|
|
121
|
+
return numericSeparator ? addNumericSeparator(obj, str) : str;
|
|
86
122
|
}
|
|
87
123
|
if (typeof obj === 'bigint') {
|
|
88
|
-
|
|
124
|
+
var bigIntStr = String(obj) + 'n';
|
|
125
|
+
return numericSeparator ? addNumericSeparator(obj, bigIntStr) : bigIntStr;
|
|
89
126
|
}
|
|
90
127
|
|
|
91
128
|
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
|
|
@@ -104,7 +141,7 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
104
141
|
|
|
105
142
|
function inspect(value, from, noIndent) {
|
|
106
143
|
if (from) {
|
|
107
|
-
seen =
|
|
144
|
+
seen = $arrSlice.call(seen);
|
|
108
145
|
seen.push(from);
|
|
109
146
|
}
|
|
110
147
|
if (noIndent) {
|
|
@@ -122,21 +159,21 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
122
159
|
if (typeof obj === 'function') {
|
|
123
160
|
var name = nameOf(obj);
|
|
124
161
|
var keys = arrObjKeys(obj, inspect);
|
|
125
|
-
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' +
|
|
162
|
+
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + $join.call(keys, ', ') + ' }' : '');
|
|
126
163
|
}
|
|
127
164
|
if (isSymbol(obj)) {
|
|
128
|
-
var symString = hasShammedSymbols ? String(obj)
|
|
165
|
+
var symString = hasShammedSymbols ? $replace.call(String(obj), /^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
|
|
129
166
|
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
|
|
130
167
|
}
|
|
131
168
|
if (isElement(obj)) {
|
|
132
|
-
var s = '<' + String(obj.nodeName)
|
|
169
|
+
var s = '<' + $toLowerCase.call(String(obj.nodeName));
|
|
133
170
|
var attrs = obj.attributes || [];
|
|
134
171
|
for (var i = 0; i < attrs.length; i++) {
|
|
135
172
|
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
|
|
136
173
|
}
|
|
137
174
|
s += '>';
|
|
138
175
|
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
|
|
139
|
-
s += '</' + String(obj.nodeName)
|
|
176
|
+
s += '</' + $toLowerCase.call(String(obj.nodeName)) + '>';
|
|
140
177
|
return s;
|
|
141
178
|
}
|
|
142
179
|
if (isArray(obj)) {
|
|
@@ -145,12 +182,15 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
145
182
|
if (indent && !singleLineValues(xs)) {
|
|
146
183
|
return '[' + indentedJoin(xs, indent) + ']';
|
|
147
184
|
}
|
|
148
|
-
return '[ ' +
|
|
185
|
+
return '[ ' + $join.call(xs, ', ') + ' ]';
|
|
149
186
|
}
|
|
150
187
|
if (isError(obj)) {
|
|
151
188
|
var parts = arrObjKeys(obj, inspect);
|
|
189
|
+
if ('cause' in obj && !isEnumerable.call(obj, 'cause')) {
|
|
190
|
+
return '{ [' + String(obj) + '] ' + $join.call($concat.call('[cause]: ' + inspect(obj.cause), parts), ', ') + ' }';
|
|
191
|
+
}
|
|
152
192
|
if (parts.length === 0) { return '[' + String(obj) + ']'; }
|
|
153
|
-
return '{ [' + String(obj) + '] ' +
|
|
193
|
+
return '{ [' + String(obj) + '] ' + $join.call(parts, ', ') + ' }';
|
|
154
194
|
}
|
|
155
195
|
if (typeof obj === 'object' && customInspect) {
|
|
156
196
|
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
|
|
@@ -198,14 +238,14 @@ module.exports = function inspect_(obj, options, depth, seen) {
|
|
|
198
238
|
var ys = arrObjKeys(obj, inspect);
|
|
199
239
|
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
|
|
200
240
|
var protoTag = obj instanceof Object ? '' : 'null prototype';
|
|
201
|
-
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? toStr(obj)
|
|
241
|
+
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? $slice.call(toStr(obj), 8, -1) : protoTag ? 'Object' : '';
|
|
202
242
|
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
|
|
203
|
-
var tag = constructorTag + (stringTag || protoTag ? '[' +
|
|
243
|
+
var tag = constructorTag + (stringTag || protoTag ? '[' + $join.call($concat.call([], stringTag || [], protoTag || []), ': ') + '] ' : '');
|
|
204
244
|
if (ys.length === 0) { return tag + '{}'; }
|
|
205
245
|
if (indent) {
|
|
206
246
|
return tag + '{' + indentedJoin(ys, indent) + '}';
|
|
207
247
|
}
|
|
208
|
-
return tag + '{ ' +
|
|
248
|
+
return tag + '{ ' + $join.call(ys, ', ') + ' }';
|
|
209
249
|
}
|
|
210
250
|
return String(obj);
|
|
211
251
|
};
|
|
@@ -216,7 +256,7 @@ function wrapQuotes(s, defaultStyle, opts) {
|
|
|
216
256
|
}
|
|
217
257
|
|
|
218
258
|
function quote(s) {
|
|
219
|
-
return String(s)
|
|
259
|
+
return $replace.call(String(s), /"/g, '"');
|
|
220
260
|
}
|
|
221
261
|
|
|
222
262
|
function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
|
|
@@ -267,7 +307,7 @@ function toStr(obj) {
|
|
|
267
307
|
|
|
268
308
|
function nameOf(f) {
|
|
269
309
|
if (f.name) { return f.name; }
|
|
270
|
-
var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
310
|
+
var m = $match.call(functionToString.call(f), /^function\s*([\w$]+)/);
|
|
271
311
|
if (m) { return m[1]; }
|
|
272
312
|
return null;
|
|
273
313
|
}
|
|
@@ -367,10 +407,10 @@ function inspectString(str, opts) {
|
|
|
367
407
|
if (str.length > opts.maxStringLength) {
|
|
368
408
|
var remaining = str.length - opts.maxStringLength;
|
|
369
409
|
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
|
|
370
|
-
return inspectString(
|
|
410
|
+
return inspectString($slice.call(str, 0, opts.maxStringLength), opts) + trailer;
|
|
371
411
|
}
|
|
372
412
|
// eslint-disable-next-line no-control-regex
|
|
373
|
-
var s =
|
|
413
|
+
var s = $replace.call($replace.call(str, /(['\\])/g, '\\$1'), /[\x00-\x1f]/g, lowbyte);
|
|
374
414
|
return wrapQuotes(s, 'single', opts);
|
|
375
415
|
}
|
|
376
416
|
|
|
@@ -384,7 +424,7 @@ function lowbyte(c) {
|
|
|
384
424
|
13: 'r'
|
|
385
425
|
}[n];
|
|
386
426
|
if (x) { return '\\' + x; }
|
|
387
|
-
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16)
|
|
427
|
+
return '\\x' + (n < 0x10 ? '0' : '') + $toUpperCase.call(n.toString(16));
|
|
388
428
|
}
|
|
389
429
|
|
|
390
430
|
function markBoxed(str) {
|
|
@@ -396,7 +436,7 @@ function weakCollectionOf(type) {
|
|
|
396
436
|
}
|
|
397
437
|
|
|
398
438
|
function collectionOf(type, size, entries, indent) {
|
|
399
|
-
var joinedEntries = indent ? indentedJoin(entries, indent) :
|
|
439
|
+
var joinedEntries = indent ? indentedJoin(entries, indent) : $join.call(entries, ', ');
|
|
400
440
|
return type + ' (' + size + ') {' + joinedEntries + '}';
|
|
401
441
|
}
|
|
402
442
|
|
|
@@ -414,20 +454,20 @@ function getIndent(opts, depth) {
|
|
|
414
454
|
if (opts.indent === '\t') {
|
|
415
455
|
baseIndent = '\t';
|
|
416
456
|
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
|
|
417
|
-
baseIndent = Array(opts.indent + 1)
|
|
457
|
+
baseIndent = $join.call(Array(opts.indent + 1), ' ');
|
|
418
458
|
} else {
|
|
419
459
|
return null;
|
|
420
460
|
}
|
|
421
461
|
return {
|
|
422
462
|
base: baseIndent,
|
|
423
|
-
prev: Array(depth + 1)
|
|
463
|
+
prev: $join.call(Array(depth + 1), baseIndent)
|
|
424
464
|
};
|
|
425
465
|
}
|
|
426
466
|
|
|
427
467
|
function indentedJoin(xs, indent) {
|
|
428
468
|
if (xs.length === 0) { return ''; }
|
|
429
469
|
var lineJoiner = '\n' + indent.prev + indent.base;
|
|
430
|
-
return lineJoiner +
|
|
470
|
+
return lineJoiner + $join.call(xs, ',' + lineJoiner) + '\n' + indent.prev;
|
|
431
471
|
}
|
|
432
472
|
|
|
433
473
|
function arrObjKeys(obj, inspect) {
|
|
@@ -454,7 +494,7 @@ function arrObjKeys(obj, inspect) {
|
|
|
454
494
|
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
|
|
455
495
|
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
|
|
456
496
|
continue; // eslint-disable-line no-restricted-syntax, no-continue
|
|
457
|
-
} else if ((/[^\w$]
|
|
497
|
+
} else if ($test.call(/[^\w$]/, key)) {
|
|
458
498
|
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
|
|
459
499
|
} else {
|
|
460
500
|
xs.push(key + ': ' + inspect(obj[key], obj));
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "object-inspect",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.12.0",
|
|
4
4
|
"description": "string representations of objects in node and the browser",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"devDependencies": {
|
|
8
|
-
"@ljharb/eslint-config": "^20.
|
|
8
|
+
"@ljharb/eslint-config": "^20.1.0",
|
|
9
9
|
"aud": "^1.1.5",
|
|
10
10
|
"auto-changelog": "^2.3.0",
|
|
11
11
|
"core-js": "^2.6.12",
|
|
12
|
-
"
|
|
12
|
+
"error-cause": "^1.0.3",
|
|
13
|
+
"es-value-fixtures": "^1.2.1",
|
|
14
|
+
"eslint": "^8.5.0",
|
|
13
15
|
"for-each": "^0.3.3",
|
|
14
16
|
"functions-have-names": "^1.2.2",
|
|
15
17
|
"has-tostringtag": "^1.0.0",
|
|
@@ -55,6 +55,7 @@ Additional options:
|
|
|
55
55
|
- `maxStringLength`: must be `0`, a positive integer, `Infinity`, or `null`, if present. Default `Infinity`.
|
|
56
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
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'`)
|
|
58
59
|
|
|
59
60
|
# install
|
|
60
61
|
|
|
@@ -42,5 +42,17 @@ test('bigint', { skip: typeof BigInt === 'undefined' }, function (t) {
|
|
|
42
42
|
);
|
|
43
43
|
});
|
|
44
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
|
+
|
|
45
57
|
t.end();
|
|
46
58
|
});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
var inspect = require('../');
|
|
2
1
|
var test = require('tape');
|
|
2
|
+
var ErrorWithCause = require('error-cause/Error');
|
|
3
|
+
|
|
4
|
+
var inspect = require('../');
|
|
3
5
|
|
|
4
6
|
test('type error', function (t) {
|
|
5
7
|
t.plan(1);
|
|
@@ -14,18 +16,33 @@ test('type error', function (t) {
|
|
|
14
16
|
cerr.message = 'whoa';
|
|
15
17
|
cerr['a-b'] = 5;
|
|
16
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
|
+
|
|
17
26
|
var obj = [
|
|
18
27
|
new TypeError(),
|
|
19
28
|
new TypeError('xxx'),
|
|
20
29
|
aerr,
|
|
21
30
|
berr,
|
|
22
|
-
cerr
|
|
31
|
+
cerr,
|
|
32
|
+
withCause,
|
|
33
|
+
withCausePlus,
|
|
34
|
+
withUndefinedCause,
|
|
35
|
+
withEnumerableCause
|
|
23
36
|
];
|
|
24
37
|
t.equal(inspect(obj), '[ ' + [
|
|
25
38
|
'[TypeError]',
|
|
26
39
|
'[TypeError: xxx]',
|
|
27
40
|
'{ [TypeError] foo: 555, bar: [ 1, 2, 3 ] }',
|
|
28
41
|
'{ [TypeError: tuv] baz: 555 }',
|
|
29
|
-
'{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }'
|
|
42
|
+
'{ [SyntaxError: whoa] message: \'whoa\', \'a-b\': 5 }',
|
|
43
|
+
'{ [Error: foo] [cause]: \'bar\' }',
|
|
44
|
+
'{ [Error: foo] [cause]: \'bar\', foo: \'bar\' }',
|
|
45
|
+
'{ [Error: foo] [cause]: undefined }',
|
|
46
|
+
'{ [Error: foo] cause: \'bar\' }'
|
|
30
47
|
].join(', ') + ' ]');
|
|
31
48
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
var inspect = require('../');
|
|
2
1
|
var test = require('tape');
|
|
2
|
+
var v = require('es-value-fixtures');
|
|
3
|
+
var forEach = require('for-each');
|
|
4
|
+
|
|
5
|
+
var inspect = require('../');
|
|
3
6
|
|
|
4
7
|
test('negative zero', function (t) {
|
|
5
8
|
t.equal(inspect(0), '0', 'inspect(0) === "0"');
|
|
@@ -10,3 +13,46 @@ test('negative zero', function (t) {
|
|
|
10
13
|
|
|
11
14
|
t.end();
|
|
12
15
|
});
|
|
16
|
+
|
|
17
|
+
test('numericSeparator', function (t) {
|
|
18
|
+
forEach(v.nonBooleans, function (nonBoolean) {
|
|
19
|
+
t['throws'](
|
|
20
|
+
function () { inspect(true, { numericSeparator: nonBoolean }); },
|
|
21
|
+
TypeError,
|
|
22
|
+
inspect(nonBoolean) + ' is not a boolean'
|
|
23
|
+
);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
t.test('3 digit numbers', function (st) {
|
|
27
|
+
var failed = false;
|
|
28
|
+
for (var i = -999; i < 1000; i += 1) {
|
|
29
|
+
var actual = inspect(i);
|
|
30
|
+
var actualSepNo = inspect(i, { numericSeparator: false });
|
|
31
|
+
var actualSepYes = inspect(i, { numericSeparator: true });
|
|
32
|
+
var expected = String(i);
|
|
33
|
+
if (actual !== expected || actualSepNo !== expected || actualSepYes !== expected) {
|
|
34
|
+
failed = true;
|
|
35
|
+
t.equal(actual, expected);
|
|
36
|
+
t.equal(actualSepNo, expected);
|
|
37
|
+
t.equal(actualSepYes, expected);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
st.notOk(failed, 'all 3 digit numbers passed');
|
|
42
|
+
|
|
43
|
+
st.end();
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
t.equal(inspect(1e3), '1000', '1000');
|
|
47
|
+
t.equal(inspect(1e3, { numericSeparator: false }), '1000', '1000, numericSeparator false');
|
|
48
|
+
t.equal(inspect(1e3, { numericSeparator: true }), '1_000', '1000, numericSeparator true');
|
|
49
|
+
t.equal(inspect(-1e3), '-1000', '-1000');
|
|
50
|
+
t.equal(inspect(-1e3, { numericSeparator: false }), '-1000', '-1000, numericSeparator false');
|
|
51
|
+
t.equal(inspect(-1e3, { numericSeparator: true }), '-1_000', '-1000, numericSeparator true');
|
|
52
|
+
|
|
53
|
+
t.equal(inspect(1234.5678, { numericSeparator: true }), '1_234.567_8', 'fractional numbers get separators');
|
|
54
|
+
t.equal(inspect(1234.56789, { numericSeparator: true }), '1_234.567_89', 'fractional numbers get separators');
|
|
55
|
+
t.equal(inspect(1234.567891, { numericSeparator: true }), '1_234.567_891', 'fractional numbers get separators');
|
|
56
|
+
|
|
57
|
+
t.end();
|
|
58
|
+
});
|
package/package.json
CHANGED
|
@@ -51,9 +51,9 @@
|
|
|
51
51
|
"jsii-pacmak": "^1.49.0",
|
|
52
52
|
"json-schema": "^0.4.0",
|
|
53
53
|
"npm-check-updates": "^12",
|
|
54
|
-
"projen": "^0.
|
|
54
|
+
"projen": "^0.44.0",
|
|
55
55
|
"standard-version": "^9",
|
|
56
|
-
"ts-jest": "^27.1.
|
|
56
|
+
"ts-jest": "^27.1.2",
|
|
57
57
|
"typescript": "^4.5.4"
|
|
58
58
|
},
|
|
59
59
|
"peerDependencies": {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"constructs": "^10.0.5"
|
|
62
62
|
},
|
|
63
63
|
"dependencies": {
|
|
64
|
-
"@aws-cdk/assert": "^2.
|
|
64
|
+
"@aws-cdk/assert": "^2.2.0",
|
|
65
65
|
"case": "^1.6.3",
|
|
66
66
|
"sync-request": "^6.1.0"
|
|
67
67
|
},
|
|
@@ -79,7 +79,7 @@
|
|
|
79
79
|
],
|
|
80
80
|
"main": "lib/index.js",
|
|
81
81
|
"license": "Apache-2.0",
|
|
82
|
-
"version": "2.0.
|
|
82
|
+
"version": "2.0.11",
|
|
83
83
|
"jest": {
|
|
84
84
|
"testMatch": [
|
|
85
85
|
"**/__tests__/**/*.ts?(x)",
|