JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 17
  • Score
    100M100P100Q57826F
  • 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.

Table of Contents

Installation

You can install the object-as-tree package via npm:

npm install object-as-tree

Features

  • Handles objects, arrays, maps, sets, and other data structures.

  • Provides info on RegExp, Date, and other special objects.

  • Provides a clear tree representation for easy debugging.

  • Detects circular references.

  • No 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));

Will produce a tree representation of the object:

{}
├─• a=1
├─• b="Hello World!"
├─• c{}
│ ├─• d=true
│ └─• e=null
├─• f{} // Date 2021-01-01T00:00:00.000Z
└─• g[3]
  ├─• 1
  ├─• 2
  └─• 3

Contributing

Contributions are welcome.

License

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