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

ntid

v1.2.1

Published

Self-documenting IDs that can be generated in any environment

Downloads

786

Readme

NTID Circle CI

NTIDs are IDs of the form Type[...] where the string between the square brackets may contain other NTIDs or a URL-safe Base64 string. NTIDs are designed to be:

  1. relatively human-readable
  2. typed (so you never accidentally mix up a user ID and a photo ID, for example)
  3. generatable anywhere (i.e. not relying on a central service to sequentially dole them out; any client can just make one up that will be unique)
  4. composable; e.g., the ID for the Like object that captures the like-state of User A liking (or not liking) Photo B, is deterministic. This is useful so that two clients, or a client and server, avoid creating separate entities for things that should be singletons. It's also useful as a primary key in RethinkDB (or any other system that doesn't allow compound primary keys).

CLI

NTID comes with a command called ntid that generates IDs. Install NTID globally with npm i -g ntid and run:

$ ntid example
example[RY7ss1F2-Y7S0nvTbNBH73]

API

makeId(type)

Takes a string denoting the type of NTID to generate and returns a new randomly generated NTID.

makeCompoundId(type, ids)

A compound NTID is made up of nested NTIDs. Like all NTIDs, it has its own type but instead of a randomly generated body, it contains nested NTIDs. The order of the nested NTIDs matches the order in which they appear in the given array, which makes them useful for directed edges.

makeSymmetricId(type, ids)

A symmetric NTID is a compound ID that sorts its nested NTIDs in a consistent manner. This is useful for undirected edges, hence the symmetry.

getTypeFromId(id)

Parses the type of the given NTID.