kolekto
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Kolekto

Collections and datastructures library for Typescript ( and javascript).

Index

Installation

npm install kolekto 

Import the parts you want.

import {BloomFilter} from "kolekto"
 
let filter = new BloomFilter<string>(10000, 0.03);

Collections

BitArray

BloomFilter

A Bloom filter is a space-efficient probabilistic data structure that is used to test whether an element is a member of a set.

False positives are possible but false negatives not. In laymen's terms this means that an element maybe be in the set or definitely not in the set. The underlying hash function is the Google's FarmHash family of hash functions. By using the the C implementation of farmhash a high insertion can be achieved.

The interface is modeled after the BloomFilter in the Google Guava library.

Example:

import {BloomFilter} from "kolekto"
 
// Create a bloomfilter with 10000 expected insertions and false positive probability of 3%
let filter = new BloomFilter<string>(10000, 0.03);
 
// Put item in bloomfilter
filter.put("test");
 
// Check if item is in bloom filter, return true if it might contain element
let result = filter.mightContain("test"); 

Package Sidebar

Install

npm i kolekto

Weekly Downloads

2

Version

1.0.2

License

MIT

Last publish

Collaborators

  • maikelh