// This is (almost) directly from Node.js utils // https://github.com/joyent/node/blob/f8c335d0caf47f16d31413f89aa28eda3878e3aa/lib/util.js var getName = require('get-func-name'); var loupe = require('loupe'); var config = require('../config'); module.exports = inspect; /** * ### .inspect(obj, [showHidden], [depth], [colors]) * * Echoes the value of a value. Tries to print the value out * in the best way possible given the different types. * * @param {Object} obj The object to print out. * @param {Boolean} showHidden Flag that shows hidden (not enumerable) * properties of objects. Default is false. * @param {Number} depth Depth in which to descend in object. Default is 2. * @param {Boolean} colors Flag to turn on ANSI escape codes to color the * output. Default is false (no coloring). * @namespace Utils * @name inspect */ function inspect(obj, showHidden, depth, colors) { var options = { colors: colors, depth: (typeof depth === 'undefined' ? 2 : depth), showHidden: showHidden, truncate: config.truncateThreshold ? config.truncateThreshold : Infinity, }; return loupe.inspect(obj, options); }