package
Native hashset for Node.js
npm install hashset-nativeGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Provides a native hashset implementation for node.
Often, when you need to use a set in JavaScript, you may instead use a JavaScript object like so:
var cache = {};
cache['foobar'] = true;
if (!cache['foobar']) {
...
}This works good for up to a few million items, but then it starts to grind v8 down to a halt.
node-hashset implements a stricly typed hashset with std::unsorted_map to enable high-volume sets.
$ npm install hashset-nativevar HashSet = require('hashset-native');
var set = new HashSet.string();
set.add('foobar');Checkout the tests for more examples.
There are currently two HashSet constructors, HashSet.int32 and HashSet.string.
Adds value to the set.
Returns a boolean value indicating if the set contains value.
Removes value from the set.
Removes all values from the set.
Returns the numbers of values in the set.