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 🙏

© 2024 – Pkg Stats / Ryan Hefner

net-tree

v8.0.0

Published

*Net Tree* is an algorithm which turns an array of items with expressed dependencies to a stream of items with expressed tree structure.

Downloads

5

Readme

Net Tree

Net Tree is an algorithm which turns an array of items with expressed dependencies to a stream of items with expressed tree structure.

Terminology:

  • item is an item being processed or the resulting item depending on context
  • super item is an item which has identifier matching one of another item's superIds, it is a super to it (this dictates nesting)
  • prior item is an item which has identifier matching one of another item's priorIds, is is a prior to it (this dictates ordering)
  • hyper item is an item which is a given item but for another super in the item's path, it is a hyper to it (this dictates flashing)

recurse(items, ownerIds)

  • items is an array of items which is never mutated by recurse
    • id is unique item identifier, most commonly a number of a string
    • superIds is an array of identifiers of super items
    • priorIds is a map describing from which super of its superIds has item which prior item (dependency for ordering)
    • state is either expanded (the item should be expanded), collapsed (the item should be collapsed), or undefined
    • data is any value with the item data
  • ownerIds is a map describing for which super of its superIds is item expanded (one at a time)

The return value is a stream of items with these fields:

  • item is the item passed in from items
  • level is the nesting level in the tree, starting at a 0 for root items
  • state is an expansion state from enumeration of:
    • expandable-explicitly-expanded means the item had a state of expanded and its current super matches its owner
    • expandable-implicitly-expanded means the item had a state of undefined and appeared first on prior order (expand by default)
    • expandable-explicitly-collapsed means the item had a state of collapsed or its current super doesn't match its owner
    • expandable-implicitly-expanded means the item had a state of undefined and didn't appear first on prior order
    • unexpandable means the item has no subitems
  • superId is an effective super of the item (from item's superIds)

Screenshot

Installing

NPM package

Running

Live demo

yarn start

Deploying

  • Update CHANGELOG.md and package.json's version
  • npm publish

Contributing

For stuff to do, see doc/tasks.