Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
persistent-hash-trie
Advanced tools
Pure string:val storage, using structural sharing.
This module forms a possible basis for effecient persistent datastructures; such as those found in Clojure's PersistentHashMap and PersistentVector.
npm install persistent-hash-trie
var p = require('persistent-hash-trie')
var trie = p.Trie()
Returns a new Trie with the new key:value keys added.
var trie1 = p.Trie()
var trie2 = p.assoc(trie1, 'key', { value: true })
Returns a new Trie without a specific key
var trie1 = p.assoc(p.Trie(), 'key', 'val')
var trie2 = p.dissoc(trie2, 'key')
Retrieves a value from a Trie.
var trie = p.assoc(p.Trie(), 'key', 'val')
p.get(trie, 'key') //= 'val'
Returns true
or false
, depending on whether the value is in the Trie.
var trie = p.assoc(p.Trie(), 'key', 'val')
p.has(trie, 'key') //= true
p.has(trie, 'not-in-here') //= false
Returns a mutable copy of a Trie, in the form of a js object.
var trie = p.assoc(p.Trie(), 'key', 'val')
p.mutable(trie) //= { key: 'val' }
Returns an array of all keys in the trie
var trie = p.assoc(p.Trie(), 'key', 'val')
p.keys(trie) //= ['key']
The hashing and equality functions used on the keys can be overidden by passing an opts object to assoc
, dissoc
, get
and has
.
var p = require('persistent-hash-trie')
var opts = {
eq: function(a, b){ return a === b},
hash: function(key){ return parseInt(key, 10) }
}
var vector = p.assoc(p.Trie(), 3, 'my-val', opts)
var val = p.get(vector, 3, opts)
var vector2 = p.dissoc(vector, 3, opts)
p.has(vector2, 3, opts) // false
npm test
and npm run benchmark
are your friends.
FAQs
Pure string:val storage, using structural sharing
The npm package persistent-hash-trie receives a total of 0 weekly downloads. As such, persistent-hash-trie popularity was classified as not popular.
We found that persistent-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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.