Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
doublearray
Advanced tools
JavaScript implementation of Double-Array trie
Weekly downloads
Readme
JavaScript implementation of Double-Array trie.
Node.js example
var doublearray = require('./doublearray.js');
var words = [
{ k: 'a', v: 1 },
{ k: 'abc', v: 2 },
{ k: '奈良', v: 3 },
{ k: '奈良先端', v: 4 },
{ k: '奈良先端科学技術大学院大学', v: 5 }
];
var trie = doublearray.builder().build(words);
Browser example
var words = [
{ k: 'a', v: 1 },
{ k: 'abc', v: 2 },
{ k: '奈良', v: 3 },
{ k: '奈良先端', v: 4 },
{ k: '奈良先端科学技術大学院大学', v: 5 }
];
var trie = doublearray.builder().build(words);
Method chaining
var trie = doublearray
.builder()
.append('a', 1)
.append('abc', 2)
.append('奈良', 3)
.append('奈良先端', 4)
.append('奈良先端科学技術大学院大学', 5)
.build();
trie.contain('a'); // -> true
trie.lookup('abc'); // -> 2
trie.commonPrefixSearch('奈良先端科学技術大学院大学');
// -> [ { v: 3, k: '奈良' },
// { v: 4, k: '奈良先端' },
// { v: 5, k: '奈良先端科学技術大学院大学' } ]
Get BASE or CHECK buffer as Int32Array of typed array
var base_buffer = trie.bc.getBaseBuffer();
var check_buffer = trie.bc.getCheckBuffer();
Load and create a new DoubleArray object from original buffers
var loaded_trie = doublearray.load(base_buffer, check_buffer);
Copyright (c) 2014 Takuya Asano All Rights Reserved.
This software is released under the MIT License. See LICENSE.txt
FAQs
JavaScript implementation of Double-Array trie
The npm package doublearray receives a total of 31,276 weekly downloads. As such, doublearray popularity was classified as popular.
We found that doublearray demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.