(obj, opts)
| 922 | */ |
| 923 | /* legacy: obj, showHidden, depth, colors*/ |
| 924 | function inspect(obj, opts) { |
| 925 | // default options |
| 926 | var ctx = { |
| 927 | seen: [], |
| 928 | stylize: stylizeNoColor |
| 929 | }; |
| 930 | // legacy... |
| 931 | if (arguments.length >= 3) ctx.depth = arguments[2]; |
| 932 | if (arguments.length >= 4) ctx.colors = arguments[3]; |
| 933 | if (isBoolean(opts)) { |
| 934 | // legacy... |
| 935 | ctx.showHidden = opts; |
| 936 | } else if (opts) { |
| 937 | // got an "options" object |
| 938 | exports._extend(ctx, opts); |
| 939 | } |
| 940 | // set default options |
| 941 | if (isUndefined(ctx.showHidden)) ctx.showHidden = false; |
| 942 | if (isUndefined(ctx.depth)) ctx.depth = 2; |
| 943 | if (isUndefined(ctx.colors)) ctx.colors = false; |
| 944 | if (isUndefined(ctx.customInspect)) ctx.customInspect = true; |
| 945 | if (ctx.colors) ctx.stylize = stylizeWithColor; |
| 946 | return formatValue(ctx, obj, ctx.depth); |
| 947 | } |
| 948 | exports.inspect = inspect; |
| 949 | |
| 950 |
no test coverage detected