
Product
Socket for Jira Is Now Available
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.
immutable-hash-trie
Advanced tools
Pure string:val storage, using structural sharing.
This module forms a possible basis for effecient immutable datastructures; such as those found in Clojure's PersistentHashMap and PersistentVector.
npm install immutable-hash-trie
var im = require('immutable-hash-trie')
var trie = im.Trie()
Returns a new Trie with the new key:value keys added.
var trie1 = im.Trie()
var trie2 = im.assoc(trie1, 'key', { value: true })
Returns a new Trie without a specific key
var trie1 = im.assoc(im.Trie(), 'key', 'val')
var trie2 = im.dissoc(trie2, 'key')
Retrieves a value from a Trie.
var trie = im.assoc(im.Trie(), 'key', 'val')
im.get(trie, 'key') //= 'val'
Returns true or false, depending on whether the value is in the Trie.
var trie = im.assoc(im.Trie(), 'key', 'val')
im.has(trie, 'key') //= true
im.has(trie, 'not-in-here') //= false
The hashing and equality functions used on the keys can be overidden by passing an opts object to assoc, dissoc, get and has.
var im = require('immutable-hash-trie')
var opts = {
eq: function(a, b){ return a === b},
hash: function(key){ return parseInt(key, 10) }
}
var vector = im.assoc(im.Trie(), 3, 'my-val', opts)
var val = im.get(vector, 3, opts)
var vector2 = im.dissoc(vector, 3, opts)
im.has(vector2, 3, opts) // false
npm test and npm run-script benchmark are your friends.
FAQs
Pure string:val storage, using structural sharing
We found that immutable-hash-trie 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.

Product
Socket for Jira lets teams turn alerts into Jira tickets with manual creation, automated ticketing rules, and two-way sync.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.