@alterior/logging 3.13.3 → 3.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/index.d.ts +4 -4
  2. package/dist/index.js +7 -7
  3. package/dist/inspect.d.ts +28 -28
  4. package/dist/inspect.js +344 -345
  5. package/dist/inspect.js.map +1 -1
  6. package/dist/inspect.test.d.ts +1 -1
  7. package/dist/logger.d.ts +145 -145
  8. package/dist/logger.js +331 -331
  9. package/dist/logger.js.map +1 -1
  10. package/dist/logger.test.d.ts +1 -1
  11. package/dist/logger.test.js.map +1 -1
  12. package/dist/logging.module.d.ts +17 -17
  13. package/dist/logging.module.js +28 -28
  14. package/dist/logging.module.js.map +1 -1
  15. package/dist/test.d.ts +1 -1
  16. package/dist/trace.d.ts +60 -60
  17. package/dist/trace.js +214 -215
  18. package/dist/trace.js.map +1 -1
  19. package/dist/trace.test.d.ts +1 -1
  20. package/dist/trace.test.js.map +1 -1
  21. package/dist.esm/index.d.ts +4 -4
  22. package/dist.esm/index.js +4 -4
  23. package/dist.esm/inspect.d.ts +28 -28
  24. package/dist.esm/inspect.js +339 -339
  25. package/dist.esm/inspect.js.map +1 -1
  26. package/dist.esm/inspect.test.d.ts +1 -1
  27. package/dist.esm/logger.d.ts +145 -145
  28. package/dist.esm/logger.js +323 -323
  29. package/dist.esm/logger.js.map +1 -1
  30. package/dist.esm/logger.test.d.ts +1 -1
  31. package/dist.esm/logger.test.js.map +1 -1
  32. package/dist.esm/logging.module.d.ts +17 -17
  33. package/dist.esm/logging.module.js +25 -25
  34. package/dist.esm/logging.module.js.map +1 -1
  35. package/dist.esm/test.d.ts +1 -1
  36. package/dist.esm/trace.d.ts +60 -60
  37. package/dist.esm/trace.js +208 -208
  38. package/dist.esm/trace.js.map +1 -1
  39. package/dist.esm/trace.test.d.ts +1 -1
  40. package/dist.esm/trace.test.js.map +1 -1
  41. package/package.json +10 -10
  42. package/tsconfig.esm.tsbuildinfo +1 -0
  43. package/tsconfig.json +0 -2
  44. package/tsconfig.tsbuildinfo +1 -5735
package/dist/inspect.js CHANGED
@@ -1,346 +1,345 @@
1
- "use strict";
2
- /**
3
- * Module exports.
4
- */
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.stylizeWithConsoleColors = exports.stylizeNothing = exports.inspect = void 0;
7
- const common_1 = require("@alterior/common");
8
- /**
9
- * Echos the value of a value. Trys to print the value out
10
- * in the best way possible given the different types.
11
- *
12
- * @param {Object} obj The object to print out.
13
- * @param {Object} opts Optional options object that alters the output.
14
- * @license MIT Joyent)
15
- */
16
- /* legacy: obj, showHidden, depth, colors*/
17
- function inspect(obj, opts) {
18
- var ctx = {
19
- seen: [],
20
- stylize: stylizeNothing
21
- };
22
- if (opts)
23
- Object.assign(ctx, opts);
24
- // set default options
25
- if (isUndefined(ctx.showHidden))
26
- ctx.showHidden = false;
27
- if (isUndefined(ctx.depth))
28
- ctx.depth = 2;
29
- if (isUndefined(ctx.colors))
30
- ctx.colors = false;
31
- if (isUndefined(ctx.customInspect))
32
- ctx.customInspect = true;
33
- if (ctx.colors)
34
- ctx.stylize = stylizeWithConsoleColors;
35
- return formatValue(ctx, obj, ctx.depth);
36
- }
37
- exports.inspect = inspect;
38
- // Don't use 'blue' not visible on cmd.exe
39
- const CONSOLE_COLOR_STYLES = {
40
- 'special': 'cyan',
41
- 'number': 'yellow',
42
- 'boolean': 'yellow',
43
- 'undefined': 'grey',
44
- 'null': 'bold',
45
- 'string': 'green',
46
- 'date': 'magenta',
47
- // "name": intentionally not styling
48
- 'regexp': 'red'
49
- };
50
- /**
51
- * Pass the string through with no stylization.
52
- */
53
- function stylizeNothing(str, styleType) {
54
- return str;
55
- }
56
- exports.stylizeNothing = stylizeNothing;
57
- function isBoolean(arg) {
58
- return typeof arg === 'boolean';
59
- }
60
- function isUndefined(arg) {
61
- return arg === void 0;
62
- }
63
- /**
64
- * Use console colors to style the string. Suitable for output to
65
- * terminals with ANSI color support.
66
- */
67
- function stylizeWithConsoleColors(str, styleType) {
68
- var style = CONSOLE_COLOR_STYLES[styleType];
69
- return style ? common_1.ConsoleColors[style](str) : str;
70
- }
71
- exports.stylizeWithConsoleColors = stylizeWithConsoleColors;
72
- function isFunction(arg) {
73
- return typeof arg === 'function';
74
- }
75
- function isString(arg) {
76
- return typeof arg === 'string';
77
- }
78
- function isNumber(arg) {
79
- return typeof arg === 'number';
80
- }
81
- function isNull(arg) {
82
- return arg === null;
83
- }
84
- function hasOwn(obj, prop) {
85
- return Object.prototype.hasOwnProperty.call(obj, prop);
86
- }
87
- function isRegExp(re) {
88
- return isObject(re) && objectToString(re) === '[object RegExp]';
89
- }
90
- function isObject(arg) {
91
- return typeof arg === 'object' && arg !== null;
92
- }
93
- function isError(e) {
94
- return isObject(e) &&
95
- (objectToString(e) === '[object Error]' || e instanceof Error);
96
- }
97
- function isDate(d) {
98
- return isObject(d) && objectToString(d) === '[object Date]';
99
- }
100
- function objectToString(o) {
101
- return Object.prototype.toString.call(o);
102
- }
103
- function arrayToHash(array) {
104
- var hash = {};
105
- array.forEach(function (val, idx) {
106
- hash[val] = true;
107
- });
108
- return hash;
109
- }
110
- function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
111
- var output = [];
112
- for (var i = 0, l = value.length; i < l; ++i) {
113
- if (hasOwn(value, String(i))) {
114
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
115
- }
116
- else {
117
- output.push('');
118
- }
119
- }
120
- keys.forEach(function (key) {
121
- if (!key.match(/^\d+$/)) {
122
- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
123
- }
124
- });
125
- return output;
126
- }
127
- function formatError(value) {
128
- return '[' + Error.prototype.toString.call(value) + ']';
129
- }
130
- function formatValue(ctx, value, recurseTimes) {
131
- // Provide a hook for user-specified inspect functions.
132
- // Check that value is an object with an inspect function on it
133
- if (ctx.customInspect &&
134
- value &&
135
- isFunction(value.inspect) &&
136
- // Filter out the util module, it's inspect function is special
137
- value.inspect !== inspect &&
138
- // Also filter out any prototype objects using the circular check.
139
- !(value.constructor && value.constructor.prototype === value)) {
140
- var ret = value.inspect(recurseTimes, ctx);
141
- if (!isString(ret)) {
142
- ret = formatValue(ctx, ret, recurseTimes);
143
- }
144
- return ret;
145
- }
146
- // Primitive types cannot have properties
147
- var primitive = formatPrimitive(ctx, value);
148
- if (primitive) {
149
- return primitive;
150
- }
151
- // Look up the keys of the object.
152
- var keys = Object.keys(value);
153
- var visibleKeys = arrayToHash(keys);
154
- try {
155
- if (ctx.showHidden && Object.getOwnPropertyNames) {
156
- keys = Object.getOwnPropertyNames(value);
157
- }
158
- }
159
- catch (e) {
160
- // ignore
161
- }
162
- // IE doesn't make error fields non-enumerable
163
- // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
164
- if (isError(value)
165
- && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
166
- return formatError(value);
167
- }
168
- // Some type of object without properties can be shortcutted.
169
- if (keys.length === 0) {
170
- if (isFunction(value)) {
171
- var name = value.name ? ': ' + value.name : '';
172
- return ctx.stylize('[Function' + name + ']', 'special');
173
- }
174
- if (isRegExp(value)) {
175
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
176
- }
177
- if (isDate(value)) {
178
- return ctx.stylize(Date.prototype.toString.call(value), 'date');
179
- }
180
- if (isError(value)) {
181
- return formatError(value);
182
- }
183
- }
184
- var base = '', array = false, braces = ['{', '}'];
185
- // Make Array say that they are Array
186
- if (Array.isArray(value)) {
187
- array = true;
188
- braces = ['[', ']'];
189
- }
190
- // Make functions say that they are functions
191
- if (isFunction(value)) {
192
- var n = value.name ? ': ' + value.name : '';
193
- base = ' [Function' + n + ']';
194
- }
195
- // Make RegExps say that they are RegExps
196
- if (isRegExp(value)) {
197
- base = ' ' + RegExp.prototype.toString.call(value);
198
- }
199
- // Make dates with properties first say the date
200
- if (isDate(value)) {
201
- base = ' ' + Date.prototype.toUTCString.call(value);
202
- }
203
- // Make error with message first say the error
204
- if (isError(value)) {
205
- base = ' ' + formatError(value);
206
- }
207
- if (keys.length === 0 && (!array || value.length == 0)) {
208
- return braces[0] + base + braces[1];
209
- }
210
- if (recurseTimes < 0) {
211
- if (isRegExp(value)) {
212
- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
213
- }
214
- else {
215
- return ctx.stylize('[Object]', 'special');
216
- }
217
- }
218
- ctx.seen.push(value);
219
- var output;
220
- if (array) {
221
- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
222
- }
223
- else {
224
- output = keys.map(function (key) {
225
- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
226
- });
227
- }
228
- ctx.seen.pop();
229
- return reduceToSingleString(output, base, braces);
230
- }
231
- function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
232
- var name, str, desc;
233
- desc = { value: void 0 };
234
- try {
235
- // ie6 navigator.toString
236
- // throws Error: Object doesn't support this property or method
237
- desc.value = value[key];
238
- }
239
- catch (e) {
240
- // ignore
241
- }
242
- try {
243
- // ie10 Object.getOwnPropertyDescriptor(window.location, 'hash')
244
- // throws TypeError: Object doesn't support this action
245
- if (Object.getOwnPropertyDescriptor) {
246
- desc = Object.getOwnPropertyDescriptor(value, key) || desc;
247
- }
248
- }
249
- catch (e) {
250
- // ignore
251
- }
252
- if (desc.get) {
253
- if (desc.set) {
254
- str = ctx.stylize('[Getter/Setter]', 'special');
255
- }
256
- else {
257
- str = ctx.stylize('[Getter]', 'special');
258
- }
259
- }
260
- else {
261
- if (desc.set) {
262
- str = ctx.stylize('[Setter]', 'special');
263
- }
264
- }
265
- if (!hasOwn(visibleKeys, key)) {
266
- name = '[' + key + ']';
267
- }
268
- if (!str) {
269
- if (ctx.seen.indexOf(desc.value) < 0) {
270
- if (isNull(recurseTimes)) {
271
- str = formatValue(ctx, desc.value, null);
272
- }
273
- else {
274
- str = formatValue(ctx, desc.value, recurseTimes - 1);
275
- }
276
- if (str.indexOf('\n') > -1) {
277
- if (array) {
278
- str = str.split('\n').map(function (line) {
279
- return ' ' + line;
280
- }).join('\n').substr(2);
281
- }
282
- else {
283
- str = '\n' + str.split('\n').map(function (line) {
284
- return ' ' + line;
285
- }).join('\n');
286
- }
287
- }
288
- }
289
- else {
290
- str = ctx.stylize('[Circular]', 'special');
291
- }
292
- }
293
- if (isUndefined(name)) {
294
- if (array && key.match(/^\d+$/)) {
295
- return str;
296
- }
297
- name = JSON.stringify('' + key);
298
- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
299
- name = name.substr(1, name.length - 2);
300
- name = ctx.stylize(name, 'name');
301
- }
302
- else {
303
- name = name.replace(/'/g, "\\'")
304
- .replace(/\\"/g, '"')
305
- .replace(/(^"|"$)/g, "'");
306
- name = ctx.stylize(name, 'string');
307
- }
308
- }
309
- return name + ': ' + str;
310
- }
311
- function formatPrimitive(ctx, value) {
312
- if (isUndefined(value))
313
- return ctx.stylize('undefined', 'undefined');
314
- if (isString(value)) {
315
- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
316
- .replace(/'/g, "\\'")
317
- .replace(/\\"/g, '"') + '\'';
318
- return ctx.stylize(simple, 'string');
319
- }
320
- if (isNumber(value))
321
- return ctx.stylize('' + value, 'number');
322
- if (isBoolean(value))
323
- return ctx.stylize('' + value, 'boolean');
324
- // For some reason typeof null is "object", so special case here.
325
- if (isNull(value))
326
- return ctx.stylize('null', 'null');
327
- }
328
- function reduceToSingleString(output, base, braces) {
329
- var numLinesEst = 0;
330
- var length = output.reduce(function (prev, cur) {
331
- numLinesEst++;
332
- if (cur.indexOf('\n') >= 0)
333
- numLinesEst++;
334
- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
335
- }, 0);
336
- if (length > 60) {
337
- return braces[0] +
338
- (base === '' ? '' : base + '\n ') +
339
- ' ' +
340
- output.join(',\n ') +
341
- ' ' +
342
- braces[1];
343
- }
344
- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
345
- }
1
+ "use strict";
2
+ /**
3
+ * Module exports.
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.inspect = inspect;
7
+ exports.stylizeNothing = stylizeNothing;
8
+ exports.stylizeWithConsoleColors = stylizeWithConsoleColors;
9
+ const common_1 = require("@alterior/common");
10
+ /**
11
+ * Echos the value of a value. Trys to print the value out
12
+ * in the best way possible given the different types.
13
+ *
14
+ * @param {Object} obj The object to print out.
15
+ * @param {Object} opts Optional options object that alters the output.
16
+ * @license MIT Joyent)
17
+ */
18
+ /* legacy: obj, showHidden, depth, colors*/
19
+ function inspect(obj, opts) {
20
+ var ctx = {
21
+ seen: [],
22
+ stylize: stylizeNothing
23
+ };
24
+ if (opts)
25
+ Object.assign(ctx, opts);
26
+ // set default options
27
+ if (isUndefined(ctx.showHidden))
28
+ ctx.showHidden = false;
29
+ if (isUndefined(ctx.depth))
30
+ ctx.depth = 2;
31
+ if (isUndefined(ctx.colors))
32
+ ctx.colors = false;
33
+ if (isUndefined(ctx.customInspect))
34
+ ctx.customInspect = true;
35
+ if (ctx.colors)
36
+ ctx.stylize = stylizeWithConsoleColors;
37
+ return formatValue(ctx, obj, ctx.depth);
38
+ }
39
+ // Don't use 'blue' not visible on cmd.exe
40
+ const CONSOLE_COLOR_STYLES = {
41
+ 'special': 'cyan',
42
+ 'number': 'yellow',
43
+ 'boolean': 'yellow',
44
+ 'undefined': 'grey',
45
+ 'null': 'bold',
46
+ 'string': 'green',
47
+ 'date': 'magenta',
48
+ // "name": intentionally not styling
49
+ 'regexp': 'red'
50
+ };
51
+ /**
52
+ * Pass the string through with no stylization.
53
+ */
54
+ function stylizeNothing(str, styleType) {
55
+ return str;
56
+ }
57
+ function isBoolean(arg) {
58
+ return typeof arg === 'boolean';
59
+ }
60
+ function isUndefined(arg) {
61
+ return arg === void 0;
62
+ }
63
+ /**
64
+ * Use console colors to style the string. Suitable for output to
65
+ * terminals with ANSI color support.
66
+ */
67
+ function stylizeWithConsoleColors(str, styleType) {
68
+ var style = CONSOLE_COLOR_STYLES[styleType];
69
+ return style ? common_1.ConsoleColors[style](str) : str;
70
+ }
71
+ function isFunction(arg) {
72
+ return typeof arg === 'function';
73
+ }
74
+ function isString(arg) {
75
+ return typeof arg === 'string';
76
+ }
77
+ function isNumber(arg) {
78
+ return typeof arg === 'number';
79
+ }
80
+ function isNull(arg) {
81
+ return arg === null;
82
+ }
83
+ function hasOwn(obj, prop) {
84
+ return Object.prototype.hasOwnProperty.call(obj, prop);
85
+ }
86
+ function isRegExp(re) {
87
+ return isObject(re) && objectToString(re) === '[object RegExp]';
88
+ }
89
+ function isObject(arg) {
90
+ return typeof arg === 'object' && arg !== null;
91
+ }
92
+ function isError(e) {
93
+ return isObject(e) &&
94
+ (objectToString(e) === '[object Error]' || e instanceof Error);
95
+ }
96
+ function isDate(d) {
97
+ return isObject(d) && objectToString(d) === '[object Date]';
98
+ }
99
+ function objectToString(o) {
100
+ return Object.prototype.toString.call(o);
101
+ }
102
+ function arrayToHash(array) {
103
+ var hash = {};
104
+ array.forEach(function (val, idx) {
105
+ hash[val] = true;
106
+ });
107
+ return hash;
108
+ }
109
+ function formatArray(ctx, value, recurseTimes, visibleKeys, keys) {
110
+ var output = [];
111
+ for (var i = 0, l = value.length; i < l; ++i) {
112
+ if (hasOwn(value, String(i))) {
113
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, String(i), true));
114
+ }
115
+ else {
116
+ output.push('');
117
+ }
118
+ }
119
+ keys.forEach(function (key) {
120
+ if (!key.match(/^\d+$/)) {
121
+ output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, key, true));
122
+ }
123
+ });
124
+ return output;
125
+ }
126
+ function formatError(value) {
127
+ return '[' + Error.prototype.toString.call(value) + ']';
128
+ }
129
+ function formatValue(ctx, value, recurseTimes) {
130
+ // Provide a hook for user-specified inspect functions.
131
+ // Check that value is an object with an inspect function on it
132
+ if (ctx.customInspect &&
133
+ value &&
134
+ isFunction(value.inspect) &&
135
+ // Filter out the util module, it's inspect function is special
136
+ value.inspect !== inspect &&
137
+ // Also filter out any prototype objects using the circular check.
138
+ !(value.constructor && value.constructor.prototype === value)) {
139
+ var ret = value.inspect(recurseTimes, ctx);
140
+ if (!isString(ret)) {
141
+ ret = formatValue(ctx, ret, recurseTimes);
142
+ }
143
+ return ret;
144
+ }
145
+ // Primitive types cannot have properties
146
+ var primitive = formatPrimitive(ctx, value);
147
+ if (primitive) {
148
+ return primitive;
149
+ }
150
+ // Look up the keys of the object.
151
+ var keys = Object.keys(value);
152
+ var visibleKeys = arrayToHash(keys);
153
+ try {
154
+ if (ctx.showHidden && Object.getOwnPropertyNames) {
155
+ keys = Object.getOwnPropertyNames(value);
156
+ }
157
+ }
158
+ catch (e) {
159
+ // ignore
160
+ }
161
+ // IE doesn't make error fields non-enumerable
162
+ // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx
163
+ if (isError(value)
164
+ && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) {
165
+ return formatError(value);
166
+ }
167
+ // Some type of object without properties can be shortcutted.
168
+ if (keys.length === 0) {
169
+ if (isFunction(value)) {
170
+ var name = value.name ? ': ' + value.name : '';
171
+ return ctx.stylize('[Function' + name + ']', 'special');
172
+ }
173
+ if (isRegExp(value)) {
174
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
175
+ }
176
+ if (isDate(value)) {
177
+ return ctx.stylize(Date.prototype.toString.call(value), 'date');
178
+ }
179
+ if (isError(value)) {
180
+ return formatError(value);
181
+ }
182
+ }
183
+ var base = '', array = false, braces = ['{', '}'];
184
+ // Make Array say that they are Array
185
+ if (Array.isArray(value)) {
186
+ array = true;
187
+ braces = ['[', ']'];
188
+ }
189
+ // Make functions say that they are functions
190
+ if (isFunction(value)) {
191
+ var n = value.name ? ': ' + value.name : '';
192
+ base = ' [Function' + n + ']';
193
+ }
194
+ // Make RegExps say that they are RegExps
195
+ if (isRegExp(value)) {
196
+ base = ' ' + RegExp.prototype.toString.call(value);
197
+ }
198
+ // Make dates with properties first say the date
199
+ if (isDate(value)) {
200
+ base = ' ' + Date.prototype.toUTCString.call(value);
201
+ }
202
+ // Make error with message first say the error
203
+ if (isError(value)) {
204
+ base = ' ' + formatError(value);
205
+ }
206
+ if (keys.length === 0 && (!array || value.length == 0)) {
207
+ return braces[0] + base + braces[1];
208
+ }
209
+ if (recurseTimes < 0) {
210
+ if (isRegExp(value)) {
211
+ return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp');
212
+ }
213
+ else {
214
+ return ctx.stylize('[Object]', 'special');
215
+ }
216
+ }
217
+ ctx.seen.push(value);
218
+ var output;
219
+ if (array) {
220
+ output = formatArray(ctx, value, recurseTimes, visibleKeys, keys);
221
+ }
222
+ else {
223
+ output = keys.map(function (key) {
224
+ return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array);
225
+ });
226
+ }
227
+ ctx.seen.pop();
228
+ return reduceToSingleString(output, base, braces);
229
+ }
230
+ function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) {
231
+ var name, str, desc;
232
+ desc = { value: void 0 };
233
+ try {
234
+ // ie6 › navigator.toString
235
+ // throws Error: Object doesn't support this property or method
236
+ desc.value = value[key];
237
+ }
238
+ catch (e) {
239
+ // ignore
240
+ }
241
+ try {
242
+ // ie10 › Object.getOwnPropertyDescriptor(window.location, 'hash')
243
+ // throws TypeError: Object doesn't support this action
244
+ if (Object.getOwnPropertyDescriptor) {
245
+ desc = Object.getOwnPropertyDescriptor(value, key) || desc;
246
+ }
247
+ }
248
+ catch (e) {
249
+ // ignore
250
+ }
251
+ if (desc.get) {
252
+ if (desc.set) {
253
+ str = ctx.stylize('[Getter/Setter]', 'special');
254
+ }
255
+ else {
256
+ str = ctx.stylize('[Getter]', 'special');
257
+ }
258
+ }
259
+ else {
260
+ if (desc.set) {
261
+ str = ctx.stylize('[Setter]', 'special');
262
+ }
263
+ }
264
+ if (!hasOwn(visibleKeys, key)) {
265
+ name = '[' + key + ']';
266
+ }
267
+ if (!str) {
268
+ if (ctx.seen.indexOf(desc.value) < 0) {
269
+ if (isNull(recurseTimes)) {
270
+ str = formatValue(ctx, desc.value, null);
271
+ }
272
+ else {
273
+ str = formatValue(ctx, desc.value, recurseTimes - 1);
274
+ }
275
+ if (str.indexOf('\n') > -1) {
276
+ if (array) {
277
+ str = str.split('\n').map(function (line) {
278
+ return ' ' + line;
279
+ }).join('\n').substr(2);
280
+ }
281
+ else {
282
+ str = '\n' + str.split('\n').map(function (line) {
283
+ return ' ' + line;
284
+ }).join('\n');
285
+ }
286
+ }
287
+ }
288
+ else {
289
+ str = ctx.stylize('[Circular]', 'special');
290
+ }
291
+ }
292
+ if (isUndefined(name)) {
293
+ if (array && key.match(/^\d+$/)) {
294
+ return str;
295
+ }
296
+ name = JSON.stringify('' + key);
297
+ if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) {
298
+ name = name.substr(1, name.length - 2);
299
+ name = ctx.stylize(name, 'name');
300
+ }
301
+ else {
302
+ name = name.replace(/'/g, "\\'")
303
+ .replace(/\\"/g, '"')
304
+ .replace(/(^"|"$)/g, "'");
305
+ name = ctx.stylize(name, 'string');
306
+ }
307
+ }
308
+ return name + ': ' + str;
309
+ }
310
+ function formatPrimitive(ctx, value) {
311
+ if (isUndefined(value))
312
+ return ctx.stylize('undefined', 'undefined');
313
+ if (isString(value)) {
314
+ var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '')
315
+ .replace(/'/g, "\\'")
316
+ .replace(/\\"/g, '"') + '\'';
317
+ return ctx.stylize(simple, 'string');
318
+ }
319
+ if (isNumber(value))
320
+ return ctx.stylize('' + value, 'number');
321
+ if (isBoolean(value))
322
+ return ctx.stylize('' + value, 'boolean');
323
+ // For some reason typeof null is "object", so special case here.
324
+ if (isNull(value))
325
+ return ctx.stylize('null', 'null');
326
+ }
327
+ function reduceToSingleString(output, base, braces) {
328
+ var numLinesEst = 0;
329
+ var length = output.reduce(function (prev, cur) {
330
+ numLinesEst++;
331
+ if (cur.indexOf('\n') >= 0)
332
+ numLinesEst++;
333
+ return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1;
334
+ }, 0);
335
+ if (length > 60) {
336
+ return braces[0] +
337
+ (base === '' ? '' : base + '\n ') +
338
+ ' ' +
339
+ output.join(',\n ') +
340
+ ' ' +
341
+ braces[1];
342
+ }
343
+ return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1];
344
+ }
346
345
  //# sourceMappingURL=inspect.js.map