{"_id":"memoize-immutable","_rev":"10-661323d51e63430e1e4ba6919050dc99","name":"memoize-immutable","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","dist-tags":{"latest":"3.0.0"},"versions":{"1.0.0":{"name":"memoize-immutable","version":"1.0.0","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"index.js","scripts":{"test":"mocha test.js"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MIT","devDependencies":{"chai":"^3.5.0","eslint":"^2.9.0","eslint-plugin-mocha":"^2.2.0","mocha":"^2.4.5","mocha-phantomjs":"^4.0.2"},"gitHead":"a2c89b486bea473e435f17201c1d1eaedbf3da13","_id":"memoize-immutable@1.0.0","_shasum":"2f3576e89dea527ad1cdce2bd19ceec48ad9c54a","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"2f3576e89dea527ad1cdce2bd19ceec48ad9c54a","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-1.0.0.tgz","integrity":"sha512-ZOp0rtyqkpHzQfX8KHNJbfFdBt3V1WAgtgcclpUKmjGQ6CPnMM7EgIfj/7q7y8RsfORa5euh1jaOeBbl30jMlA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQChxiCg2tRQtGpHyPq9dHBTw5vhil8UeHWD1eOMiyqlfQIhAMOoeCyX+ea8yqpBMzH6twgBAYppyS+nGyb2A9RRT25W"}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/memoize-immutable-1.0.0.tgz_1463233536135_0.47736578597687185"}},"1.1.0":{"name":"memoize-immutable","version":"1.1.0","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"index.js","scripts":{"test":"mocha test.js"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MIT","devDependencies":{"chai":"^3.5.0","eslint":"^2.9.0","eslint-plugin-mocha":"^2.2.0","mocha":"^2.4.5","mocha-phantomjs":"^4.0.2"},"gitHead":"8d8a84e5d531a02cae762f44f21d3b1e23b70c0c","_id":"memoize-immutable@1.1.0","_shasum":"4f1f8f89280c3196595faf84bc6851946e238d00","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"4f1f8f89280c3196595faf84bc6851946e238d00","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-1.1.0.tgz","integrity":"sha512-Wut7Ly9KKuKov24LkSov8WJSNvAxja86VBNW/3t7afH2ne+beFHeBw7HonzBVWrL5BGCheP47uW7iCj/J0JXxA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAQkAWt1G61hk6kw3H+oqU5irebPd6eDFRJ2Ls9YvopjAiEAu8E/SOYvz7GBN7zkjDjPZrPy1VCcODTETeb47up+ZVw="}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/memoize-immutable-1.1.0.tgz_1463518261000_0.6945421379059553"}},"1.1.1":{"name":"memoize-immutable","version":"1.1.1","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"index.js","scripts":{"test":"mocha test.js"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MIT","devDependencies":{"chai":"^3.5.0","eslint":"^2.9.0","eslint-plugin-mocha":"^2.2.0","mocha":"^2.4.5","mocha-phantomjs":"^4.0.2"},"repository":{"type":"git","url":"git+https://github.com/louisremi/memoize-immutable.git"},"bugs":{"url":"https://github.com/louisremi/memoize-immutable/issues"},"gitHead":"51e3518a8a713ab9b0040092e8a2864113df129e","homepage":"https://github.com/louisremi/memoize-immutable#readme","_id":"memoize-immutable@1.1.1","_shasum":"1aec250438138f2a65eb7058c95147468fb00bdf","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"1aec250438138f2a65eb7058c95147468fb00bdf","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-1.1.1.tgz","integrity":"sha512-TGbvnlzfJ1qGsPtNuoOIrjEO0zALs6OI9RO8pE7xzhpaxiOhw1BVIwbxLdtS1I4a6Un+gQnOBilpjkPrJ87Aiw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQD50vquz0I5hOnsEVVrlMlp7TYXFFU+ceYPnlgQsTheyAIhAKsl8FG08N451mqkPKokxKcNDIapfWM+CPQrYauI8YLc"}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/memoize-immutable-1.1.1.tgz_1463562879870_0.5343072912655771"}},"2.0.0":{"name":"memoize-immutable","version":"2.0.0","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"index.js","engines":{"node":">=4.4.4"},"scripts":{"test":"mocha test.js && node --allow-natives-syntax test-is-optimized.js"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MIT","devDependencies":{"chai":"^3.5.0","chalk":"^1.1.3","eslint":"^2.9.0","eslint-plugin-mocha":"^2.2.0","mocha":"^2.4.5","mocha-phantomjs":"^4.0.2"},"repository":{"type":"git","url":"git+https://github.com/louisremi/memoize-immutable.git"},"bugs":{"url":"https://github.com/louisremi/memoize-immutable/issues"},"gitHead":"629aee10cd6bc6ca0235cb633c2a932e9eddab66","homepage":"https://github.com/louisremi/memoize-immutable#readme","_id":"memoize-immutable@2.0.0","_shasum":"5e70408a3205508c5d691b45ee50052889eec73c","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"5e70408a3205508c5d691b45ee50052889eec73c","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-2.0.0.tgz","integrity":"sha512-+AZA/ZHrjmCXM+FYRMjVeAxpskLZK6H0nqM2kNcbinbLMrUWd210WzzFmVPn8hWvv7sIJahOGcyUz6JYjLxyLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIA4DEKT7MHNIOmeuKYYwE9sRsH/APEpYwEE98tT9F6EjAiBLMlRajTHl4hzwRuZUjCVicEl/XmML0qKgyuxzoCkzHg=="}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/memoize-immutable-2.0.0.tgz_1463654017231_0.7508066263981164"}},"2.1.0":{"name":"memoize-immutable","version":"2.1.0","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"index.js","engines":{"node":">=4.4.4"},"scripts":{"test":"mocha test.js && node --allow-natives-syntax test-is-optimized.js"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MIT","devDependencies":{"chai":"^3.5.0","chalk":"^1.1.3","eslint":"^2.9.0","eslint-plugin-mocha":"^2.2.0","mocha":"^2.4.5","mocha-phantomjs":"^4.0.2"},"repository":{"type":"git","url":"git+https://github.com/louisremi/memoize-immutable.git"},"bugs":{"url":"https://github.com/louisremi/memoize-immutable/issues"},"gitHead":"51cd16305fa55f0097b6f8181877f2f12995f47b","homepage":"https://github.com/louisremi/memoize-immutable#readme","_id":"memoize-immutable@2.1.0","_shasum":"71632f0a29540bbbfca6fead5344d697067e60b3","_from":".","_npmVersion":"2.14.12","_nodeVersion":"4.3.1","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"71632f0a29540bbbfca6fead5344d697067e60b3","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-2.1.0.tgz","integrity":"sha512-9RVI2OceRr3xRG5qYZsEv2BRLUR9Y74AIRFKhEZKRWlbAuo38IwcpHKXtUL9dAgjFaxmokYa2HxatCJgVkXp1A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDx2fiBbodSnvsj/i89mkH1i52rrkLqZ2tmsj0cva6NDgIgE5uvECwVjVWuUuENM5jkhQyoUL5oQnlBoHiPUWr7p40="}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/memoize-immutable-2.1.0.tgz_1463755836585_0.5211725500412285"}},"3.0.0":{"name":"memoize-immutable","version":"3.0.0","description":"An efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.","main":"dist/index.js","jsnext:main":"index.js","engines":{"node":">=6.6.0"},"scripts":{"lint":"eslint ./index.js ./__tests__/index.test.js","jest":"jest ./__tests__/index.test.js --coverage","coverage":"jest ./__tests__/index.test.js --coverage && cat ./coverage/lcov.info | coveralls","test":"npm run jest && npm run lint","test:optimized":"node --allow-natives-syntax __tests__/test-is-optimized.js","clean":"rimraf dist/ && mkdir dist/","build":"npm test && npm run clean && babel index.js --out-file dist/index.js --source-maps && npm run test:optimized"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MPL-2.0","dependencies":{"tuplemap":"^1.0.2","lrumap":"^1.0.0","mixedtuplemap":"^1.0.0","namedtuplemap":"^1.0.0","weaktuplemap":"^1.0.0"},"devDependencies":{"babel-cli":"^6.18.0","babel-jest":"^18.0.0","babel-plugin-add-module-exports":"^0.2.1","babel-preset-es2015":"^6.18.0","chalk":"^1.1.3","coveralls":"^2.11.15","eslint":"^3.12.2","eslint-plugin-mocha":"^4.7.0","jest":"^18.0.0","rimraf":"^2.5.4"},"optionalDependencies":{"lrumap":"^1.0.0","mixedtuplemap":"^1.0.0","namedtuplemap":"^1.0.0","weaktuplemap":"^1.0.0"},"repository":{"type":"git","url":"git+https://github.com/memoize-immutable/memoize-immutable.git"},"bugs":{"url":"https://github.com/memoize-immutable/memoize-immutable/issues"},"gitHead":"05d1c1bb6fe22fea7bcbff5573402bcc288a6694","homepage":"https://github.com/memoize-immutable/memoize-immutable#readme","_id":"memoize-immutable@3.0.0","_shasum":"5959ee50a4f11d7be45b1afc8b2c6daa7c6d2e1e","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.6.0","_npmUser":{"name":"louisremi","email":"lrbabe@gmail.com"},"dist":{"shasum":"5959ee50a4f11d7be45b1afc8b2c6daa7c6d2e1e","tarball":"https://registry.npmjs.org/memoize-immutable/-/memoize-immutable-3.0.0.tgz","integrity":"sha512-oPoS/0cvUEWc8X1WP/6PkYLFFlX9A9GlPpxQt21hzKqydQXGTc4fZa3YDsSyErUxBICx4LROtoKZ3Mk1ocrCBg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICnBi3PDi1mtfAzggW1k9lVBGdl5d5XyDCHLk+snXEpoAiEAxsaiML0EAPLHwOPYaIWVUde0j0yP8MzBDVrwl+LunrU="}]},"maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/memoize-immutable-3.0.0.tgz_1482342345056_0.8986739802639931"}}},"readme":"# Memoize Immutable [![npm version](https://badge.fury.io/js/memoize-immutable.svg)](https://badge.fury.io/js/memoize-immutable) [![Build Status](https://travis-ci.org/memoize-immutable/memoize-immutable.svg?branch=master)](https://travis-ci.org/memoize-immutable/memoize-immutable) [![Dependency Status](https://david-dm.org/memoize-immutable/memoize-immutable.svg)](https://david-dm.org/memoize-immutable/memoize-immutable) [![Coverage Status](https://coveralls.io/repos/github/memoize-immutable/memoize-immutable/badge.svg?branch=master)](https://coveralls.io/github/memoize-immutable/memoize-immutable?branch=master)\n\nAn efficient memoizer for functions that only receive immutable arguments. Ideal for Redux and similar environments.\n\nThis lib is only compatible with browsers that implement `WeakMap` and `Map` natively.\n(which have [good browser support](https://kangax.github.io/compat-table/es6/#test-Map)).\n\n## How is it different from other memoizers?\n\nIn order to index cached results, most memoizers serialize arguments using `JSON.stringify` or similar methods.\nWhen working with immutable data, using a WeakMap based cache is much more CPU and memory efficient.\nThis memoizer is designed to work with such caches.\n\n## Install\n\n    npm install --save memoize-immutable\n\n## API\n\n    memoize( fn [, options ] )\n\n- `fn`: the function to memoize\n- `options` (optionnal):\n  - `cache`: a cache instance implementing `.has`, `.get` and `.set` methods (defaults to TupleMap)\n  - `limit`: limit the size of the default cache (incompatible with `cache` option)\n\n`return`s a memoized function.\nNote: the `.displayName` of the returned function will be `'<original name>Memoized'`.\n\n## Usage\n\n```javascript\nvar memoize = require('memoize-immutable');\n\nvar nbExecs = 0;\nvar arraySum = function(arr) {\n  nbExecs++;\n  return arr.reduce(function(acc, curr) {\n    return acc + curr;\n  }, 0);\n};\nvar arraySumMemoized = memoize(arraySum);\n\n\nvar arr1 = [ 1, 2, 3, 4, 5, 6 ];\nvar copy = arr1;\n\nexpect(arraySumMemoized(arr1)).to.equal(21);\nexpect(nbExecs).to.equal(1);\n\nexpect(arraySumMemoized(copy)).to.equal(21);\nexpect(nbExecs).to.equal(1);\n\n// Of course, you shouldn't mutate the arguments, or else...\narr1.push(7);\nexpect(arraySumMemoized(arr1)).to.equal(21);\nexpect(nbExecs).to.equal(1);\n\nvar clone = arr1.concat();\nexpect(arraySumMemoized(clone)).to.equal(28);\nexpect(nbExecs).to.equal(2);\n```\n\n## Choosing a cache store\n\nNB: When in doubt, don't use an optional cache.\n\nThe following instructions will help choose optimal cache store for a given function. Before you proceed, make sure you know the definition of the following terms:\n- *primitive*: Any `number`, `string`, `boolean`, `undefined` or `null` value is considered primitive.\n- *non-primitive*: An `object`, `array` or `function` value is non-primitive.\n- *named arguments*: here is a function that doesn't accept named arguments:\n    `drawRect(20, 50, 100, 150, '#000');`\n  and the same function, accepting named arguments:\n    `drawRect({x: 20, y: 50, width: 100, height: 150, color: '#000'});`\n  which is expected to have the exact same result as:\n    `drawRect({color: '#000', width: 100, height: 150, x: 20, y: 50});`\n\n1. The function accepts a single argument (**not named argument**, see below)\n  1. The function accepts a single non-primitive argument.\n     → use a native WeakMap.\n  2. The function accepts a single primitive argument.\n     → use the LRUMap (or a native Map if its size isn't a problem).\n2. The function accepts multiple arguments, but the number of arguments never changes\n  1. The function accepts primitive arguments, **always mixed with at least one non-primitive argument**\n     → use the MixedTupleMap.\n  2. The function only accepts non-primitive arguments.\n     → use the WeakTupleMap.\n3. The function accepts a single object of named arguments\n  → use the NamedTupleMap.\n4. **In any other case**\n   → use the default TupleMap.\n\n## license\n\nMPL-2.0\n\n## Author\n\n[@louis_remi](https://twitter.com/louis_remi)\n","maintainers":[{"name":"louisremi","email":"lrbabe@gmail.com"}],"time":{"modified":"2022-06-19T17:44:54.863Z","created":"2016-05-14T13:45:38.666Z","1.0.0":"2016-05-14T13:45:38.666Z","1.1.0":"2016-05-17T20:51:03.593Z","1.1.1":"2016-05-18T09:14:42.153Z","2.0.0":"2016-05-19T10:33:39.324Z","2.1.0":"2016-05-20T14:50:40.507Z","3.0.0":"2016-12-21T17:45:45.702Z"},"keywords":["immutable","memoize","redux"],"author":{"name":"@louis_remi"},"license":"MPL-2.0","readmeFilename":"README.md","homepage":"https://github.com/memoize-immutable/memoize-immutable#readme","repository":{"type":"git","url":"git+https://github.com/memoize-immutable/memoize-immutable.git"},"bugs":{"url":"https://github.com/memoize-immutable/memoize-immutable/issues"}}