npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@iktumi/tree

v1.0.2

Published

A module that provides a tree structure and methods to manipulate the structure.

Readme

tree

A module that provides a tree structure and methods to manipulate the structure.

It also provides an easy way to convert between tree struture and array.

Install

This package is only served through OpenBits.

To install OpenBits run:

npm install openbits -g

Then login into openbits by following these instructions.

When OpenBits is set up, then install tree as followings:

openbits install @iktumi/tree

Usage

Import the package:

import tree from '@iktumi/tree';

Create a new Tree:

let worldMapTree = new tree.Tree();

Add some nodes to the tree:

worldMapTree.append(new tree.Node({id: 1,name: "Europe"}));
worldMapTree.append(new tree.Node({id: 2,name: "Africa"}));
worldMapTree.append(new tree.Node({id: 3,name: "America"}));
worldMapTree.append(new tree.Node({id: 4,name: "Australia"}));
worldMapTree.append(new tree.Node({id: 5,name: "Antarctica"}));

worldMapTree.insert(new tree.Node({id: 6,name: "Portugal"}) , 1 );
worldMapTree.insert(new tree.Node({id: 7,name: "Spain"}), 1 );
worldMapTree.insert(new tree.Node({id: 8,name: "France"}), 1 );

worldMapTree.insert(new tree.Node({id: 9,name: "Egypt"}), 2 );
worldMapTree.insert(new tree.Node({id: 10,name: "South Africa"}), 2 );

worldMapTree.insert(new tree.Node({id: 11,name: "Angola"}), 2 );
worldMapTree.insert(new tree.Node({id: 12,name: "Cabinda"}), 11 );
worldMapTree.insert(new tree.Node({id: 13,name: "Benguela"}), 11 );

Print the tree:

worldMapTree.print();

This will output:

Root
    {"id":1,"name":"Europe"}
        {"id":6,"name":"Portugal"}
        {"id":7,"name":"Spain"}
        {"id":8,"name":"France"}
    {"id":2,"name":"Africa"}
        {"id":9,"name":"Egypt"}
        {"id":11,"name":"Angola"}
            {"id":12,"name":"Cabinda"}
            {"id":13,"name":"Benguela"}
        {"id":10,"name":"South Africa"}
    {"id":3,"name":"America"}
    {"id":4,"name":"Australia"}
    {"id":5,"name":"Antarctica"}

You can also set a tree using an array of JSONs.

Each JSON must have a parentId and a node with attribute id and any additional data.

let placesList = [
  {
    parentId: 0,
    node: {
      id: 1,
      name: "Europe"
    }
  },
  {
    parentId: 0,
    node: {
      id: 2,
      name: "America"
    }
  },
  {
    parentId: 0,
    node: {
      id: 3,
      name: "Africa"
    }
  },
  {
    parentId: 0,
    node: {
      id: 4,
      name: "Angola"
    }
  },
  {
    parentId: 1,
    node: {
      id: 5,
      name: "Spain"
    }
  },
  {
    parentId: 1,
    node: {
      id: 6,
      name: "Portugal"
    }
  }

]

let worldMapCopy = new tree.Tree();
worldMapCopy.loadFromArray(placesList); 

It is also possible to transform the tree into an array:

worldMapTree.toArray()