1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.default = inspect;
|
7 |
|
8 | function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 | function inspect(value) {
|
23 | switch (_typeof(value)) {
|
24 | case 'string':
|
25 | return JSON.stringify(value);
|
26 |
|
27 | case 'function':
|
28 | return value.name ? "[function ".concat(value.name, "]") : '[function]';
|
29 |
|
30 | case 'object':
|
31 | if (value) {
|
32 | if (typeof value.inspect === 'function') {
|
33 | return value.inspect();
|
34 | } else if (Array.isArray(value)) {
|
35 | return '[' + value.map(inspect).join(', ') + ']';
|
36 | }
|
37 |
|
38 | var properties = Object.keys(value).map(function (k) {
|
39 | return "".concat(k, ": ").concat(inspect(value[k]));
|
40 | }).join(', ');
|
41 | return properties ? '{ ' + properties + ' }' : '{}';
|
42 | }
|
43 |
|
44 | return String(value);
|
45 |
|
46 | default:
|
47 | return String(value);
|
48 | }
|
49 | } |
\ | No newline at end of file |