Skip to content

onesy-me/hash-table

Repository files navigation



onesy logo

onesy Hash table

Hash table


MIT license     Production ready     UMD 1.5kb gzipped     100% test cov     Browser and Nodejs

Very simple code     Modern code     Junior friendly     Typescript     Made with 💛


Getting started

Add

yarn add @onesy/hash-table

Use cases

  • Indexing data
  • Caching
  • Storage for data, for efficient quering
  • Storing relationships between data
  • etc.

Use

  import OnesyHashTable from '@onesy/hash-table';

  // Make a new hash table instance
  const onesyHashTable = new OnesyHashTable();

  // Add values
  onesyHashTable.set('a', 14).set('a1', 114);

  onesyHashTable.get('a');
  // 14

  onesyHashTable.get('a14');
  // undefined

  // Remove
  onesyHashTable.remove('a');
  // true

  onesyHashTable.get('a');
  // undefined

Dev

Install

yarn

Test

yarn test

Prod

Build

yarn build