{"_id":"persistent-hash-trie","_rev":"112186","name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","dist-tags":{"latest":"0.4.2"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"time":{"modified":"2021-06-03T10:44:15.000Z","created":"2013-03-27T13:10:10.770Z","0.4.2":"2014-01-08T09:18:27.471Z","0.4.1":"2013-05-24T19:24:23.492Z","0.4.0":"2013-05-23T20:21:53.924Z","0.3.2":"2013-04-03T22:52:58.125Z","0.3.1":"2013-03-31T01:59:58.517Z","0.3.0":"2013-03-29T22:57:52.522Z","0.2.4":"2013-03-29T02:00:10.251Z","0.2.3":"2013-03-27T13:10:10.770Z"},"users":{},"author":{"name":"hughfdjackson"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"versions":{"0.4.2":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.4.2","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","benchmark":"node benchmark/benchmarks.js"},"dependencies":{"string-hash":"1.1.0"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0","format-number":"0.0.0","mori":"0.2.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","bugs":{"url":"https://github.com/hughfdjackson/persistent-hash-trie/issues"},"_id":"persistent-hash-trie@0.4.2","dist":{"shasum":"4044b2fe82d723e6cecd963213f4c4c76a112552","size":15814,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.4.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.4.2.tgz"},"_from":".","_npmVersion":"1.3.11","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1389172707471,"_cnpm_publish_time":1389172707471,"_hasShrinkwrap":false},"0.4.1":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.4.1","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","benchmark":"node benchmark/benchmarks.js"},"dependencies":{"string-hash":"1.1.0"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0","format-number":"0.0.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","bugs":{"url":"https://github.com/hughfdjackson/persistent-hash-trie/issues"},"_id":"persistent-hash-trie@0.4.1","dist":{"shasum":"41f773964bac120524fe6b4ac988fcdf0e93524c","size":24151,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.4.1.tgz"},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1369423463492,"_cnpm_publish_time":1369423463492,"_hasShrinkwrap":false},"0.4.0":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.4.0","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","benchmark":"node benchmark/benchmarks.js"},"dependencies":{"string-hash":"1.1.0"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0","format-number":"0.0.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","bugs":{"url":"https://github.com/hughfdjackson/persistent-hash-trie/issues"},"_id":"persistent-hash-trie@0.4.0","dist":{"shasum":"1159eb799979a6286aaed4184e0f50abc29cda7f","size":24486,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.4.0.tgz"},"_from":".","_npmVersion":"1.2.21","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1369340513924,"_cnpm_publish_time":1369340513924,"_hasShrinkwrap":false},"0.3.2":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.3.2","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","prepublish":"npm test","benchmark":"node benchmark/benchmarks.js"},"dependencies":{"string-hash":"1.1.0"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0","format-number":"0.0.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","_id":"persistent-hash-trie@0.3.2","dist":{"shasum":"83a8edd895e993c5b11625822b278e2b497f967c","size":24283,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.3.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.3.2.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1365029578125,"_cnpm_publish_time":1365029578125,"_hasShrinkwrap":false},"0.3.1":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.3.1","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","prepublish":"npm test","benchmark":"node benchmark/benchmarks.js"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","opera/10.0","opera/12.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","_id":"persistent-hash-trie@0.3.1","dist":{"shasum":"a0a968478fb4d59d9285e976118ccc148f21a3db","size":84431,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.3.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.3.1.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1364695198517,"_cnpm_publish_time":1364695198517,"_hasShrinkwrap":false},"0.3.0":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.3.0","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","prepublish":"npm test","benchmark":"node benchmark/benchmarks.js"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4","string-hash":"1.1.0"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","opera/10.0","opera/12.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","_id":"persistent-hash-trie@0.3.0","dist":{"shasum":"f8483ac6e6dda3d5b8d5d6cc81a3a3cad14f55f3","size":83906,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.3.0.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1364597872522,"_cnpm_publish_time":1364597872522,"_hasShrinkwrap":false},"0.2.4":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.2.4","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","prepublish":"npm test","benchmark":"node benchmark/benchmarks.js"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","opera/10.0","opera/12.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","_id":"persistent-hash-trie@0.2.4","dist":{"shasum":"8bda1bece1f717349908b44b6e0be408bd80114c","size":32873,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.2.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.2.4.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1364522410251,"_cnpm_publish_time":1364522410251,"_hasShrinkwrap":false},"0.2.3":{"name":"persistent-hash-trie","description":"Pure string:val storage, using structural sharing","version":"0.2.3","main":"src/persistent-hash-trie.js","scripts":{"test":"mocha","prepublish":"npm test","benchmark":"node benchmark/benchmarks.js"},"dependencies":{"string-hash":"1.1.0"},"devDependencies":{"mocha":"1.8.1","lodash":"1.0.1","benchmark":"1.0.0","microtime":"0.3.3","better-stack-traces":"0.0.4"},"repository":{"type":"git","url":"https://github.com/hughfdjackson/persistent-hash-trie.git"},"testling":{"files":"test/*-test.js","browsers":["iexplore/6.0","iexplore/7.0","iexplore/8.0","iexplore/9.0","iexplore/10.0","chrome/4.0","chrome/23.0","firefox/3.0","firefox/17.0","opera/10.0","opera/12.0","safari/5.0.5","safari/5.1"],"harness":"mocha"},"keywords":["persistent","hash","trie","pure","functional","datastructure","bagwell","clojure","immutability"],"author":{"name":"hughfdjackson"},"license":"BSD","readmeFilename":"README.markdown","_id":"persistent-hash-trie@0.2.3","dist":{"shasum":"f81ab21d47db8140e1287607931306d17355c2ba","size":33872,"noattachment":false,"key":"/persistent-hash-trie/-/persistent-hash-trie-0.2.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/persistent-hash-trie/download/persistent-hash-trie-0.2.3.tgz"},"_from":".","_npmVersion":"1.2.2","_npmUser":{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"},"maintainers":[{"name":"hughfdjackson","email":"hughfdjackson@googlemail.com"}],"directories":{},"publish_time":1364389810770,"_cnpm_publish_time":1364389810770,"_hasShrinkwrap":false}},"readme":"# persistent-hash-trie\n\nPure string:val storage, using structural sharing.\n\n[![browser support](https://ci.testling.com/hughfdjackson/persistent-hash-trie.png)](https://ci.testling.com/hughfdjackson/persistent-hash-trie)\n\n## Why\n\nThis module forms a possible basis for effecient persistent datastructures; such as those found in Clojure's PersistentHashMap and PersistentVector.\n\n## Install\n\n`npm install persistent-hash-trie`\n\n## Docs\n\n### Trie\n\n```javascript\nvar p = require('persistent-hash-trie')\n\nvar trie = p.Trie()\n```\n\n### assoc\n\nReturns a new Trie with the new key:value keys added.\n\n```javascript\nvar trie1 = p.Trie()\nvar trie2 = p.assoc(trie1, 'key', { value: true })\n```\n\n### dissoc\n\nReturns a new Trie without a specific key\n\n```javascript\nvar trie1 = p.assoc(p.Trie(), 'key', 'val')\nvar trie2 = p.dissoc(trie2, 'key')\n```\n\n### get\n\nRetrieves a value from a Trie.\n\n```javascript\nvar trie = p.assoc(p.Trie(), 'key', 'val')\np.get(trie, 'key') //= 'val'\n```\n\n### has\n\nReturns `true` or `false`, depending on whether the value is in the Trie.\n\n```javascript\nvar trie = p.assoc(p.Trie(), 'key', 'val')\np.has(trie, 'key') \t\t//= true\np.has(trie, 'not-in-here') //= false\n```\n\n### transient\n\nReturns a mutable copy of a Trie, in the form of a js object.\n\n```javascript\nvar trie = p.assoc(p.Trie(), 'key', 'val')\np.transient(trie) //= { key: 'val' }\n```\n\n### Extending assoc/dissoc/get/has\n\nThe hashing and equality functions used on the keys can be overidden by passing an opts object to `assoc`, `dissoc`, `get` and `has`.\n\n```javascript\nvar im = require('persistent-hash-trie')\n\nvar opts = {\n\teq: function(a, b){ return a === b},\n\thash: function(key){ return parseInt(key, 10) }\n}\n\nvar vector = p.assoc(p.Trie(), 3, 'my-val', opts)\nvar val = p.get(vector, 3, opts)\nvar vector2 = p.dissoc(vector, 3, opts)\np.has(vector2, 3, opts) // false\n```\n\n## Running tests and benchmarks\n\n`npm test` and `npm run-script benchmark` are your friends.\n","_attachments":{},"readmeFilename":"README.markdown","bugs":{"url":"https://github.com/hughfdjackson/persistent-hash-trie/issues"},"license":"BSD"}