jsm-treeify
Version:
A library to display JavaScript objects as colorized, tree-like structures in the console.
21 lines (20 loc) • 749 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const colorize_tree_1 = __importDefault(require("./colorize-tree"));
/**
* Transforms an object into a colored, tree-like string representation for console output.
*
* @param obj - The object to display as a tree.
* @returns A formatted string representation of the object as a tree.
*/
const jsmTreeify = (obj, opt = {
maxDepth: 10,
maxObjectItems: 30,
showArrayIndices: true,
sortKeys: false,
prefix: '',
}) => '\n' + (0, colorize_tree_1.default)(obj, opt).join('\n') + '\n';
exports.default = jsmTreeify;
;