{"_id":"hamt_plus","_rev":"19-ebc51c8579210f2649be1df207b283cd","name":"hamt_plus","description":"Fork of HAMT that adds transient mutation and support for custom key types","dist-tags":{"latest":"1.0.2"},"versions":{"0.0.0":{"name":"hamt_plus","version":"0.0.0","description":"Fork of HAMT that adds a transaction interface and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.0","dist":{"shasum":"49d588b4589f65fcbd48e7991d413d04b7bdce05","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.0.tgz","integrity":"sha512-jrzRmTpdoezS/39XtZGzGXzD6REjG/r92fNQfu5AU7/rfYq2cTIDN2fjCvUt3x7x9JRsyejwFFSFc7bZaHSFIw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCGWerjVL2RXAm/L/fUCGQ28HvCalryw0yq3nC/0IDmswIhANOYtOeHSmYRyW1j42u7e0OXjhcpoEFE2ndIizgdxUhS"}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.1":{"name":"hamt_plus","version":"0.0.1","description":"Fork of HAMT that adds a transaction interface and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.1","dist":{"shasum":"ba6f20277bed00574b136988eabeb60c5872bf9c","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.1.tgz","integrity":"sha512-wYmsl1L55fcZq67BejASn4Wv6ZCbMGzfTUq61/7IBp+3rEeRhOJStLcp/qdAbdM/1JHNa9vpApV2fSl/D1c96Q==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIDiQrgW1j3YdKgnaAYVVHihEswPfSj5h6UHtPELrYffgAiEAoR5Jqewq5Q0YIexA3bngxUgZmZ+Qr0LM6CsTofmCYtQ="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.2":{"name":"hamt_plus","version":"0.0.2","description":"Fork of HAMT that adds a transaction interface and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.2","dist":{"shasum":"3a9ce8758f760e6a64abd2707a0ebde2f4911e08","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.2.tgz","integrity":"sha512-hZtqS9UnD4Xb5kiv0FdeRX84xz1T3VfSQ+TB01jDtD90pLlEGuZoKocy2KhXjGRWbp2oXPhEfSKMHTNwM9w3xA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQChx82ZrlgSWI/sDLzdcBmqPTYt9cKZ4OCs29uIOrrOXwIgON5lLPDm05tafGSgTybdLjz6HbVwh8kjDtLdngPLMWo="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.3":{"name":"hamt_plus","version":"0.0.3","description":"Fork of HAMT that adds a transaction interface and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.3","dist":{"shasum":"b75c48b58faae339e7d74dcbda2f204f8c15ad5b","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.3.tgz","integrity":"sha512-RuWkk7x+ShAqjx/yhg9b5pqUIGmm8qnGd62xPjVrIT4c+6J7kJXwtw0kb0xS9I68UP6HT6lnNgb9lh0y1F4CGw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC8ugcCcp/gNkUrRZ+17BCelcLaHt5bKoRDoydBCr11CAIgUGak8pxo2CTMQpzkYC89g2BwFFKihor6UbXcnG7kJbE="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.4":{"name":"hamt_plus","version":"0.0.4","description":"Fork of HAMT that adds a transaction interface and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.4","dist":{"shasum":"649d6f80e61d378796848445024ab83548ae3c71","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.4.tgz","integrity":"sha512-/SoMi5nNcas/RM5RDsaznJvodLFDOcpGjkoA+h33cmscvrtIP/sMqTyv/Aa4MmKUEGqbvJRy5jSD//iXBOVZpw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCVpN4JCCfrUysK8Oi0Vqpd5nl/Rk8YYppp3eEac7ClMgIhAPJwhmMTGW+YAnHMkhC3q1J1xplvf56y5bSiWvo1zv/O"}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.5":{"name":"hamt_plus","version":"0.0.5","description":"Fork of HAMT that adds transient mutation and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.5","dist":{"shasum":"ee3c978e65f4492f28797c20620521a6b20cfe83","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.5.tgz","integrity":"sha512-fzBgSfwzw99nfmsB3XMrCkSArfu1UW73cx/+qB0N+Haep+Oh/pI+n7SeUpDcxN+2/8xD/kSZrQZpJFv2OBtKsw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBN2VXvgNvVpsdVbdqzsiQVKF9PZgESoyD5eFUj8c3+mAiBHLuzwxhjuew+qla5XMo3MLY8QB4ZgwIWP7ymh00DlhA=="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"0.0.6":{"name":"hamt_plus","version":"0.0.6","description":"Fork of HAMT that adds transient mutation and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"https://github.com/mattbierner/hamt_plus.git"},"main":"dist_node/hamt.js","directories":{"lib":"dist_node"},"files":["dist_node/","lib","test","test.js","index.js"],"dependencies":{},"devDependencies":{"nodeunit":"0.8.x"},"scripts":{"test":"node test.js"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus","_id":"hamt_plus@0.0.6","dist":{"shasum":"ee9eb8d550894b3fead0b62bf8fc846e0ccd778b","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-0.0.6.tgz","integrity":"sha512-xJUJFRJMjIWiHj8oWEaOKU/zNqDHpwCO19MJsXUlVXvWc2c9ZSeW3UvSzTKZ+XyMLTlNJYJ0ycgmEsJgwQqBuA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBGgzmPioX44OqOnqlNpPNnWvOknBllsSAOMae0jMEmrAiBPdkw1HFeh9xxxR52gIIk5VTlEPY1hh/YqO9YaNNG5dQ=="}]},"_from":".","_npmVersion":"1.4.6","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}]},"1.0.0":{"name":"hamt_plus","version":"1.0.0","description":"Fork of HAMT that adds transient mutation and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mattbierner/hamt_plus.git"},"main":"hamt.js","files":["hamt.js","hamt.js.map"],"dependencies":{},"devDependencies":{"babel-preset-es2015":"^6.3.0","gulp":"^3.9.0","gulp-babel":"^6.1.0","gulp-plumber":"^1.0.0","gulp-sourcemaps":"^1.6.0","chai":"*","mocha":"*"},"scripts":{"test":"mocha tests"},"gitHead":"156d2985f1e17e49a5a19f300032ffe516ebfc33","bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus#readme","_id":"hamt_plus@1.0.0","_shasum":"b1da17eeeb498767f3336f862f3054c387b1e63e","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}],"dist":{"shasum":"b1da17eeeb498767f3336f862f3054c387b1e63e","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.0.tgz","integrity":"sha512-tBUpkjJGrKkxWKnMfUnAKdnwNnxPDgQ3QVVJ0lLiTsLJncYnh3TDgTIqoGmjrfjydv0Up7fZvRedqQ43mnOkgg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDiAXAcff2yDqSm9SPvQGkJHIpfpk3V9SM75oZU3QsTJgIgMyg1yg2mY0AzjG4+76zFynHt82fRWxeGamYenyJfzr4="}]}},"1.0.1":{"name":"hamt_plus","version":"1.0.1","description":"Fork of HAMT that adds transient mutation and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mattbierner/hamt_plus.git"},"main":"hamt.js","files":["hamt.js","hamt.js.map"],"dependencies":{},"devDependencies":{"babel-preset-es2015":"^6.3.0","gulp":"^3.9.0","gulp-babel":"^6.1.0","gulp-plumber":"^1.0.0","gulp-sourcemaps":"^1.6.0","chai":"*","mocha":"*"},"scripts":{"test":"mocha tests"},"gitHead":"4894fe4d7853bf9d2fbc3c7ad8f7fde2a8b4def7","bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus#readme","_id":"hamt_plus@1.0.1","_shasum":"9325733b8267fb54a33465a2e638a23f1d918b4a","_from":".","_npmVersion":"3.3.9","_nodeVersion":"5.0.0","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}],"dist":{"shasum":"9325733b8267fb54a33465a2e638a23f1d918b4a","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.1.tgz","integrity":"sha512-sCwNUsG2ECA2cxSYy8JBt/vsFCmrwvHEmTIdL4MfXUHuenHLQvaYfLKWWdvHVw6kD/IZR/CemOh50iK4j4z8QQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD+VCKl0KehYcBhzmO5se9Y3+ami7KCXlLmI34gcEAo+QIgOClgqysHzw5/W6GKqiDWU5ZfvZUs2JwK3mqSrDlOKwE="}]}},"1.0.2":{"name":"hamt_plus","version":"1.0.2","description":"Fork of HAMT that adds transient mutation and support for custom key types","keywords":["trie","hamt","map","persistent","data structure","hash"],"author":{"name":"Matt Bierner"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/mattbierner/hamt_plus.git"},"main":"hamt.js","files":["hamt.js","hamt.js.map"],"dependencies":{},"devDependencies":{"babel-preset-es2015":"^6.24.0","gulp":"^3.9.0","gulp-babel":"^6.1.2","gulp-plumber":"^1.1.0","gulp-sourcemaps":"^2.4.0","chai":"*","mocha":"*"},"scripts":{"compile":"gulp","test":"mocha tests"},"gitHead":"b8845c7343fdde3966f875d732248fec597cf538","bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"homepage":"https://github.com/mattbierner/hamt_plus#readme","_id":"hamt_plus@1.0.2","_shasum":"e21c252968c7e33b20f6a1b094cd85787a265601","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.6.0","_npmUser":{"name":"mattbierner","email":"mattbierner@gmail.com"},"maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}],"dist":{"shasum":"e21c252968c7e33b20f6a1b094cd85787a265601","tarball":"https://registry.npmjs.org/hamt_plus/-/hamt_plus-1.0.2.tgz","integrity":"sha512-t2JXKaehnMb9paaYA7J0BX8QQAY8lwfQ9Gjf4pg/mk4krt+cmwmU652HOoWonf+7+EQV97ARPMhhVgU1ra2GhA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD4152wFOkwgYqGieeaPpb+qbbrj/xa+9sLyb2LV+j4eAIgRweDJO0VCivvA9slClHg6pWyWYSb4QZA95lh9fst6HI="}]},"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/hamt_plus-1.0.2.tgz_1489643264124_0.037898669485002756"}}},"readme":"<div align=\"center\" >\n    <img src=\"https://raw.githubusercontent.com/mattbierner/hamt_plus/master/documentation/hamt-logo.png\" alt=\"H.A.M.T.+\" />\n</div>\n\nFork of the [Hamt][hamt] ([hash array mapped trie][hash-array-mapped-trie]) library. This fork adds a few important features in exchange for very slightly degraded performance:\n\n* Transient mutation. This allows efficient mass operations, while retaining the safety of a persistent data structure.\n* Supports using a custom key comparision function.\n* Supports using a custom hash function.\n\nThe Hamt+ Api is a superset of Hamt's Api. Hamt+ supports any key type using the custom hash and key comparision functions.\n\n## Install\nSource code is in `hamt.js` and generated from `lib/hamt.js`. The library supports node, AMD, and use as a global.\n\n### Node\n``` sh\n$ npm install hamt\n```\n\n``` javascript\nvar hamt = require('hamt_plus');\n\nvar h = hamt.empty.set('key', 'value');\n\n...\n```\n\n\n### AMD\n``` javascript\nrequirejs.config({\n    paths: {\n        'hamt': 'path/to/hamt_plus/'\n    }\n});\n\nrequire(['hamt'], function(hamt) {\n    var h = hamt.empty.set('key', 'value');\n    ...\n});\n```\n\n\n# Usage\nHamt+ provides a method chaining interface and free functions for updating and querying the map. Both APIs provide identical functionality, but the free functions are designed for binding and composition, while the method chaining API is more legible and more Javascripty.\n\nHAMTs are is persistent, so operations always return a modified copy of the map instead of altering the original.\n\n## Custom Hash Values\nMost update and lookup methods have two versions: one that takes a key and uses an internal hash function to compute its hash, and a version that takes a custom computed hash value.\n\n\n``` javascript\nvar h = hamt.empty.set('key', 'value');\nvar h2 = hamt.empty.setHash(5, 'key', 'value');\n\n\nh.get('key') === 'value'\nh2.getHash(5, 'key') === 'value'\n```\n\nIf using a custom hash, you must only use the `*Hash` variant of functions to interact with the map.\n\n\n``` javascript\n// Because the internally computed hash of `key` is not `5`, a direct\n// look will not work.\nh2.get('key') === undefined\n\n// You must use `getHash` with the same hash value originally passed in.\nh2.getHash(5, 'key') === 'value'\n```\n\n\n## API\n\n#### `hamt.make(config)`\nCreate a new, empty map.\n\n* `config` – Optional. Holds the custom hash and key compare functions: `{ hash: myHashFunction, keyEq: myKeyCompareFunction }`\n\n```js\nconst Vec2 = (x, y) => ({ x: x, y: y });\n\nconst vecMap = hamt.make({\n    hash: (value) => hamt.hash(value.x + ',' + value.y),\n    keyEq: (a, b) => a.x === b.x && a.y === b.y\n});\n\nvecMap = vecMap.set(Vec2(1, 2), 'value');\n\nvecMap.get(Vec2(1, 2)) === 'value'\n```\n\n#### `hamt.empty`\nAn empty map.\n\nUses default key compare function and hash functions.\n\n----\n\n#### `hamt.isEmpty(map)`\n#### `map.isEmpty()`\nIs a map empty?\n\nThis is the correct method to check if a map is empty. Direct comparisons to `hamt.empty` will not work.\n\n----\n\n#### `hamt.get(key, map)`\n#### `map.get(key)`\nLookup the value for `key` in `map`.\n\n* `key` - String key.\n* `map` - Hamt map.\n\n``` javascript\nvar h = hamt.empty.set('key', 'value');\n\nh.get('key') === 'value'\nhamt.get('key', k) === 'value'\n\nh.get('no such key') === undefined\n```\n\n----\n\n#### `hamt.getHash(hash, key, map)`\n#### `map.getHash(hash, key)`\nSame as `get` but uses a custom hash value.\n\n----\n\n#### `hamt.tryGet(alt, key, map)`\n#### `map.tryGet(alt, key)`\nSame as `get` but returns `alt` if no value for `key` exists.\n\n* `alt` - Value returned if no such key exists in the map.\n* `key` - String key.\n* `map` - Hamt map.\n\n----\n\n#### `hamt.has(key, map)`\n#### `map.has(key)`\nDoes an entry for `key` exist in `map`?\n\n* `key` - String key.\n* `map` - Hamt map.\n\n``` javascript\nvar h = hamt.empty.set('key', 'value');\n\nh.has('key') === true\nh.has('no such key') === false\n```\n\n----\n\n#### `hamt.tryGetHash(alt, hash, key, map)`\n#### `map.tryGetHash(alt, hash, key)`\nSame as `tryGet` but uses a custom hash value.\n\n----\n\n#### `hamt.set(key, value, map)`\n#### `map.set(key, value)`\nSet the value for `key` in `map`.\n\n* `value` - Value to store. Hamt supports all value types, including: literals, objects, falsy values, null, and undefined. Keep in mind that only the map data structure itself is guaranteed to be immutable. Using immutable values is recommended but not required.\n* `key` - String key.\n* `map` - Hamt map.\n\nReturns a new map with the value set. Does not alter the original.\n\n``` javascript\nvar h = hamt.empty\n    .set('key', 'value');\n    .set('key2', 'value2');\n\nvar h2 = h.set('key3', 'value3');\n\nh2.get('key') === 'value'\nh2.get('key2') === 'value2'\nh2.get('key3') === 'value3'\n\n// original `h` was not modified\nh.get('key') === 'value'\nh.get('key2') === 'value2'\nh.get('key3') === undefined\n```\n\n----\n\n#### `hamt.setHash(hash, key, value, map)`\n#### `map.setHash(hash, key, value)`\nSame as `set` but uses a custom hash value.\n\n----\n\n#### `hamt.modify(f, key, map)`\n#### `map.modify(key, f)`\nUpdate the value stored for `key` in `map`.\n\n* `f` - Function mapping the current value to the new value. If no current value exists, the function is invoked with no arguments.\n* `key` - String key.\n* `map` - Hamt map.\n\nReturns a new map with the modified value. Does not alter the original.\n\n``` javascript\nvar h = hamt.empty\n    .set('i', 2);\n\nvar h2 = h.modify('i', x => x * x);\n\nh2.get('i') === 4\nh.get('i') === 2\nh2.count() === 1\nh.count() === 1\n\n// Operate on value that does not exist\nvar h3 = h.modify('new', x => {\n    if (x === undefined) {\n        return 10;\n    }\n    return -x;\n});\n\nh3.get('new') === 10\nh3.count() === 2\n```\n\n----\n\n#### `hamt.modifyHash(f, hash, key, map)`\n#### `map.modifyHash(hash, key, f)`\nSame as `modify` but uses a custom hash value.\n\n----\n\n#### `hamt.remove(key, map)`\n#### `map.remove(key)`\n#### `map.delete(key)`\nRemove `key` from `map`.\n\n* `key` - String key.\n* `map` - Hamt map.\n\nReturns a new map with the value removed. Does not alter the original.\n\n``` javascript\nvar h = hamt.empty\n    .set('a', 1)\n    .set('b', 2)\n    .set('c', 3);\n\nvar h2 = h.remove('b');\n\nh2.count() === 2;\nh2.get('a') === 1\nh2.get('b') === undefined\nh2.get('c') === 3\n```\n\n----\n\n#### `hamt.removeHash(hash, key, map)`\n#### `map.removeHash(hash, key)`\n#### `map.deleteHash(hash, key)`\nSame as `remove` but uses a custom hash value.\n\n----\n\n#### `hamt.count(map)`\n#### `map.count()`\n#### `map.size`\nGet number of elements in `map`.\n\n* `map` - Hamt map.\n\n\n``` javascript\nhamt.empty.count() === 0;\nhamt.empty.set('a', 3).count() === 1;\nhamt.empty.set('a', 3).set('b', 3).count() === 2;\n```\n\n----\n\n#### `hamt.fold(f, z, map)`\n#### `map.fold(f, z)`\nFold over the map, accumulating result value.\n\n* `f` - Function invoked with accumulated value, current value, and current key.\n* `z` - Initial value.\n* `map` - Hamt map.\n\nOrder is not guaranteed.\n\n``` javascript\nvar max = hamt.fold.bind(null,\n    (acc, value, key) => Math.max(acc, value),\n    0);\n\nmax(hamt.empty.set('key', 3).set('key', 4)) === 4;\n```\n\n----\n\n#### `hamt.entries(map)`\n#### `map.entries()`\nGet an Javascript iterator to all key value pairs in `map`.\n\n* `map` - Hamt map.\n\nOrder is not guaranteed.\n\n``` javascript\nArray.from(hamt.empty.entries()) === [];\nArray.from(hamt.empty.set('a', 3).entries()) === [['a', 3]];\nArray.from(hamt.empty.set('a', 3).set('b', 3).entries()) === [['a', 3], ['b', 3]];\n```\n\nYou can also iterated directly over a map with ES6:\n\n```javascript\nconst h = hamt.empty.set('a', 3).set('b', 3);\n\nfor (let [key, value] of h)\n    ...\n\nArray.from(h) === [['a', 3], ['b', 3]];\n```\n\n----\n\n#### `hamt.key(map)`\n#### `map.keys()`\nGet an Javascript iterator to all keys in `map`.\n\n* `map` - Hamt map.\n\nOrder is not guaranteed.\n\n``` javascript\nArray.from(hamt.empty.keys()) === [];\nArray.from(hamt.empty.set('a', 3).keys()) === ['a'];\nArray.from(hamt.empty.set('a', 3).set('b', 3).keys()) === ['a', 'b'];\n```\n\n----\n\n#### `hamt.values(map)`\n#### `map.values()`\nGet an Javascript iterator to all values in `map`.\n\n* `map` - Hamt map.\n\nOrder is not guaranteed. Duplicate entries may exist.\n\n``` javascript\nArray.from(hamt.empty.values()) === [];\nArray.from(hamt.empty.set('a', 3).values()) === [3];\nArray.from(hamt.empty.set('a', 3).values('b', 3).values()) === [3, 3];\n```\n\n----\n\n#### `hamt.forEach(f, map)`\n#### `map.forEach(f)`\nInvoke function `f` for each value in the map.\n\n* `f` - Function invoked with `(value, key, map)`.\n* `map` - Hamt map.\n\nOrder is not guaranteed.\n\n----\n\n#### `hamt.beginMutation(map)`\n#### `map.beginMutation()`\nStart the mutation of `map`. The number of calls to `beginMutation` is counted, but mutation itself is binary: the map is either mutable or immutable. Mutation cannot leak before the first call to `beginMutation` or after the matching call to `endMutation.`\n\n----\n\n#### `hamt.endMutation(map)`\n#### `map.endMutation()`\nEnd the mutation of `map`.\n\n----\n\n#### `hamt.mutate(f, map)`\n#### `map.mutate(f)`\nMutate `map` within the context of function `f`.\n\n```js\nconst insert = ['a', 'b', 'c'];\n\nconst h = hamt.mutate(h =>\n    // any operations within this block may mutate `h` internally.\n    insert.forEach((x, i) => {\n        h.set(x, i);\n    }),\n    hamt.empty);\n\nh.count() === 3;\nh.get('b') === 2;\n```\n\n## Development\nAny contributions to Hamt+ are welcome. Feel free to open an [issues](https://github.com/mattbierner/hamt_plus/issues) if you run into problems or have a suggested improvement.\n\nTo develop Hamt, fork the repo and install the development node packages:\n\n```bash\ncd hamt_plus\n$ npm install\n```\n\nThe source is written in ES6 and lives in `lib/hamt.js`. Gulp and Bable are used to translate the ES6 code to an ES5 distribution found in `hamt.js`. To start the compiler:\n\n```bash\n$ gulp default\n```\n\nTests are written in Mocha and found in `tests/*`. To run the tests:\n\n```js\n$ mocha tests\n```\n\n[hamt]: https://github.com/mattbierner/hamt\n[benchmarks]: http://github.com/mattbierner/js-hashtrie-benchmark\n[pdata]: https://github.com/exclipy/pdata\n[hash-array-mapped-trie]: http://en.wikipedia.org/wiki/Hash_array_mapped_trie\n[persistent]: http://en.wikipedia.org/wiki/Persistent_data_structure\n","maintainers":[{"name":"mattbierner","email":"mattbierner@gmail.com"}],"time":{"modified":"2022-06-18T18:49:44.702Z","created":"2014-08-19T00:58:16.279Z","0.0.0":"2014-08-19T00:58:16.279Z","0.0.1":"2014-08-19T03:31:52.439Z","0.0.2":"2014-08-19T06:40:55.216Z","0.0.3":"2014-08-19T07:22:43.066Z","0.0.4":"2014-08-22T02:52:49.048Z","0.0.5":"2014-08-22T12:58:36.169Z","0.0.6":"2014-09-27T20:39:49.833Z","1.0.0":"2016-01-27T06:20:57.400Z","1.0.1":"2016-01-28T03:26:00.614Z","1.0.2":"2017-03-16T05:47:45.973Z"},"homepage":"https://github.com/mattbierner/hamt_plus#readme","keywords":["trie","hamt","map","persistent","data structure","hash"],"repository":{"type":"git","url":"git+https://github.com/mattbierner/hamt_plus.git"},"author":{"name":"Matt Bierner"},"bugs":{"url":"https://github.com/mattbierner/hamt_plus/issues"},"license":"MIT","readmeFilename":"README.md"}