You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

mnemonist

Package Overview
Dependencies
13
Maintainers
1
Versions
69
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

mnemonist

Curated collection of data structures for the JavaScript/TypeScript.


Version published
Maintainers
1
Created

Package description

What is mnemonist?

The mnemonist package is a collection of data structures for JavaScript and TypeScript. It provides a variety of advanced data structures that are not available in the standard JavaScript library, allowing developers to handle complex data manipulation tasks more efficiently.

What are mnemonist's main functionalities?

FibonacciHeap

FibonacciHeap is a heap data structure that allows for efficient retrieval and modification of the minimum element. It is particularly efficient for mergeable heap operations.

const { FibonacciHeap } = require('mnemonist');
const heap = new FibonacciHeap();
heap.push(3, 'three');
heap.push(1, 'one');
heap.pop(); // -> 'one'

Trie

Trie is a tree-like data structure that is used to store a dynamic set or associative array where the keys are usually strings. It is useful for tasks like autocomplete where prefix-based search is needed.

const { Trie } = require('mnemonist');
const trie = new Trie();
trie.add('cat');
trie.add('can');
trie.has('cat'); // -> true

SuffixArray

SuffixArray is a data structure that provides an efficient way to search for substrings within a given string. It is useful for text processing and search applications.

const { SuffixArray } = require('mnemonist');
const suffixArray = new SuffixArray('banana');
suffixArray.search('ana'); // -> [1, 3]

BKTree

BKTree is a tree data structure for approximate string matching. It is useful for spell checking, fuzzy searching, and other applications where you need to find strings that are similar to a target string.

const { BKTree } = require('mnemonist');
const tree = new BKTree(levenshtein);
tree.add('book');
tree.add('back');
tree.search('bock', 2); // -> [{word: 'book', distance: 1}, {word: 'back', distance: 1}]

Other packages similar to mnemonist

Changelog

Source

0.39.8

  • Fixing Float64Vector TS exports (@atombrenner).
  • Improving performance of FixedDeque #.push & #.pop methods (@jerome-benoit).
  • Fixing some FixedDeque & CircularBuffer methods.

Readme

Source

Build Status

Mnemonist

Mnemonist is a curated collection of data structures for the JavaScript language.

It gathers classic data structures (think heap, trie etc.) as well as more exotic ones such as Buckhard-Keller trees etc.

It strives at being:

  • As performant as possible for a high-level language.
  • Completely modular (don't need to import the whole library just to use a simple heap).
  • Simple & straightforward to use and consistent with JavaScript standard objects' API.
  • Completely typed and comfortably usable with Typescript.

Installation

npm install --save mnemonist

Documentation

Full documentation for the library can be found here.

Classics

Low-level & structures for very specific use cases

Information retrieval & Natural language processing

Space & time indexation

Metric space indexation

Probabilistic & succinct data structures

Utility classes


Note that this list does not include a Graph data structure, whose implementation is usually far too complex for the scope of this library.

However, we advise the reader to take a look at the graphology library instead.

Don't find the data structure you need? Maybe we can work it out together.

Contribution

Contributions are obviously welcome. Be sure to lint the code & add relevant unit tests.

# Installing
git clone git@github.com:Yomguithereal/mnemonist.git
cd mnemonist
npm install

# Linting
npm run lint

# Running the unit tests
npm test

License

MIT

Keywords

FAQs

Package last updated on 02 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc