Niema's Hash Set implementation in JavaScript
Example
console.log("Creating new Hash Set...");
const words = ['Alexander', 'Niema', 'Moshiri', 'Niema'];
console.log("Adding elements: " + words.join(' '));
for(const word of words) {
hs.add(word);
}
console.log(hs);
const has_check = 'Alexander';
console.log(`Checking if Hash Set has: ${has_check}`);
console.log(hs.has(has_check));
console.log(`Deleting and re-checking: ${has_check}`);
hs.delete(has_check);
console.log(hs);
console.log(hs.has(has_check));
console.log("Creating copy from raw bytes and checking equality...");
buf = hs.dump();
console.log(hs.equals(hs2));
console.log("Creating copy from file and checking equality...");
const fn = 'hashset.hsj';
hs.dump(fn);
console.log(hs.equals(hs3));
Definition HashSet.js:113
static load(fn)
Definition HashSet.js:193