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

native-trie

v0.1.3

Published

An abstract in-memory trie structure

Downloads

2

Readme

Native NodeJS trie module

npm i native-trie

It is designed to be fast and handle large tries.

Currently stores whole trie in memory. Currently has only two methods: insert and match.

The nodes of the trie graph are unicode code points. And in the memory are stored as short UTF-8 strings but can be easily expanded to 32 bit integers which can fit any unicode code point.

Note the combining characters and diacritical marks are treated as a separate nodes in the graph so symbols like 'é' ('\u00E9') and 'é' ('\u0065\u0301') will be represented as different entities. If you need these cases to be identical consider using text normalization before calling insert and match.

The insert function

The insert function creates all required nodes in the trie and stores a terminal value at it's last node.

The match function

The match function searches the trie and returns all terminal values that have exact match.

The matchPartial function

The matchPartial function searches for the given sequence in the trie but does not stop at the exact match. Instead it searches in breadth the trie for all possible continuations of it. The result is an object where keys are depth of a node after last matched element and the keys are the nodes for corresponding depths. The search can be limited by depth and by number of elements.