JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16
  • Score
    100M100P100Q57541F
  • License MIT

Visualise a Javascript/Typescript object in a tree structure

Package Exports

  • object-as-tree
  • object-as-tree/dist/index.mjs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-as-tree) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Object as Tree

A lightweight utility for visualizing JavaScript/TypeScript objects in a tree structure in the console.

Table of Contents

Installation

Install the package as a dev dependency using npm:

npm install --save-dev object-as-tree

Features

  • Supports objects, arrays, maps, sets, and other common data structures.

  • Displays info for RegExp, Date, and other special objects.

  • Provides a clear tree representation for easy debugging.

  • Detects circular references.

  • Zero dependencies.

Usage

import { asTree } from 'object-as-tree';

const myObject= {
    a: 1,
    b: "Hello World!",
    c: {
        d: true,
        e: null
    },
    f:new Date('2021-01-01'),
    g:[1,2,3],
};

console.log(asTree(myObject));

This will output a tree representation of the object:

Object{}
├─• a: 1
├─• b: 'Hello World!'
├─• c: Object{}
│ ├─• d: true
│ └─• e: null
├─• f: Date(2021-01-01T00:00:00.000Z)
└─• g: Array(3)
  ├─• 0: 1
  ├─• 1: 2
  └─• 2: 3

Contributing

Contributions are welcome. Open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.