MCPcopy Create free account
hub / github.com/Distributive-Network/PythonMonkey / inspect

Function inspect

python/pythonmonkey/builtin_modules/util.js:333–376  ·  view source on GitHub ↗
(obj, opts = undefined)

Source from the content-addressed store, hash-verified

331 */
332/* Legacy: obj, showHidden, depth, colors*/
333function inspect(obj, opts = undefined)
334{
335 // Default options
336 const ctx = {
337 seen: [],
338 stylize: stylizeNoColor,
339 showHidden: inspectDefaultOptions.showHidden,
340 depth: inspectDefaultOptions.depth,
341 colors: inspectDefaultOptions.colors,
342 customInspect: inspectDefaultOptions.customInspect,
343 showProxy: inspectDefaultOptions.showProxy,
344 maxArrayLength: inspectDefaultOptions.maxArrayLength,
345 breakLength: inspectDefaultOptions.breakLength,
346 indentationLvl: 0
347 };
348 // Legacy...
349 if (arguments.length > 2)
350 {
351 if (arguments[2] !== undefined)
352 {
353 ctx.depth = arguments[2];
354 }
355 if (arguments.length > 3 && arguments[3] !== undefined)
356 {
357 ctx.colors = arguments[3];
358 }
359 }
360 // Set user-specified options
361 if (typeof opts === 'boolean')
362 {
363 ctx.showHidden = opts;
364 }
365 else if (opts)
366 {
367 const optKeys = Object.keys(opts);
368 for (let i = 0; i < optKeys.length; i++)
369 {
370 ctx[optKeys[i]] = opts[optKeys[i]];
371 }
372 }
373 if (ctx.colors) ctx.stylize = stylizeWithColor;
374 if (ctx.maxArrayLength === null) ctx.maxArrayLength = Infinity;
375 return formatValue(ctx, obj, ctx.depth);
376}
377inspect.custom = customInspectSymbol;
378
379Object.defineProperty(inspect, 'defaultOptions', {

Callers 1

formatFunction · 0.85

Calls 1

formatValueFunction · 0.85

Tested by

no test coverage detected