{
  "_args": [
    [
      {
        "raw": "mem@4.0.0",
        "scope": null,
        "escapedName": "mem",
        "name": "mem",
        "rawSpec": "4.0.0",
        "spec": "4.0.0",
        "type": "version"
      },
      "/home/zkochan/src/pnpm/packages/pnpm"
    ]
  ],
  "_from": "mem@4.0.0",
  "_id": "mem@4.0.0",
  "_inCache": true,
  "_location": "/mem",
  "_nodeVersion": "8.11.4",
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/mem_4.0.0_1535391218283_0.18788295308356084"
  },
  "_npmUser": {
    "name": "sindresorhus",
    "email": "sindresorhus@gmail.com"
  },
  "_npmVersion": "5.6.0",
  "_phantomChildren": {},
  "_requested": {
    "raw": "mem@4.0.0",
    "scope": null,
    "escapedName": "mem",
    "name": "mem",
    "rawSpec": "4.0.0",
    "spec": "4.0.0",
    "type": "version"
  },
  "_requiredBy": [
    "/",
    "/@pnpm/npm-resolver",
    "/@pnpm/tarball-fetcher"
  ],
  "_resolved": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz",
  "_shasum": "6437690d9471678f6cc83659c00cbafcd6b0cdaf",
  "_shrinkwrap": null,
  "_spec": "mem@4.0.0",
  "_where": "/home/zkochan/src/pnpm/packages/pnpm",
  "author": {
    "name": "Sindre Sorhus",
    "email": "sindresorhus@gmail.com",
    "url": "sindresorhus.com"
  },
  "bugs": {
    "url": "https://github.com/sindresorhus/mem/issues"
  },
  "dependencies": {
    "map-age-cleaner": "^0.1.1",
    "mimic-fn": "^1.0.0",
    "p-is-promise": "^1.1.0"
  },
  "description": "Memoize functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input",
  "devDependencies": {
    "ava": "*",
    "delay": "^3.0.0",
    "xo": "*"
  },
  "directories": {},
  "dist": {
    "integrity": "sha512-WQxG/5xYc3tMbYLXoXPm81ET2WDULiU5FxbuIoNbJqLOOI8zehXFdZuiUEgfdrU2mVB1pxBZUGlYORSrpuJreA==",
    "shasum": "6437690d9471678f6cc83659c00cbafcd6b0cdaf",
    "tarball": "https://registry.npmjs.org/mem/-/mem-4.0.0.tgz",
    "fileCount": 4,
    "unpackedSize": 6886,
    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbhDXzCRA9TVsSAnZWagAAuogP/0BeGsvg/qP/EEHQAJxP\nPiIfi0gi6nP5qtX0dDqjKJALBYsFoRXJx9gFGr3MiyzQTGHulnSUBopmN/Um\nXBTeTw3jm97scLC71ozFIZRAUC9QFUs0j6RtRYNPghT6NgstB0sZZjMNASp5\nAepb4bOCNhb/j81EkMfNrGtFeOvq2/fzxnkwEbK581hWewCzLcH4E4our4Aq\nVfMvV/wTss9BNhAgM5GbhNOhr9ys1h2dThmjTkATlZE+lkULCAYYydA1spXM\nONTW+RjoCLjwjZ4xlSiPpy9y0AWhSSldXAqd7JByVHuRLCfw5mbBYJ96tgpy\nAP+nU41+SeiQRTV327Jjqie//D7s40CYqIlDXntUPsVNmO87qwNYxQ0HyYKP\n0+SN1Rhv4YhIUn0xtwHASUZR/O4q7cWD3VabeTA3wMGP2kbqV7XXVs9haqjj\n58XhT7euHZMetI6aUlkOPVP1gEG4yRy5E1HbtDfEC9fntIeH6WzyAvq6zrGT\nl4A/xBqT1wVdmbulnIx/32NnFNbZlmcse3dZv9R2vYp4Rn1fg0mXh7W4HRyu\nlS41J2yGxLdcUSfSFe//9kJn4kI9yQ7hBp00BVUTcXmZub2gUj45AazrVvRc\nKzs/a9Vxvu5JcDHTKO5H8LnNSclq3IEWLQXd8l4LvtzH7B7rtBdQUYJH2wn9\nxi+s\r\n=Fhi4\r\n-----END PGP SIGNATURE-----\r\n"
  },
  "engines": {
    "node": ">=6"
  },
  "files": [
    "index.js"
  ],
  "gitHead": "159369f78b3dc80b72c999e11ba1b350376cc3e4",
  "homepage": "https://github.com/sindresorhus/mem#readme",
  "keywords": [
    "memoize",
    "function",
    "mem",
    "memoization",
    "cache",
    "caching",
    "optimize",
    "performance",
    "ttl",
    "expire",
    "promise"
  ],
  "license": "MIT",
  "maintainers": [
    {
      "name": "sindresorhus",
      "email": "sindresorhus@gmail.com"
    }
  ],
  "name": "mem",
  "optionalDependencies": {},
  "readme": "# mem [![Build Status](https://travis-ci.org/sindresorhus/mem.svg?branch=master)](https://travis-ci.org/sindresorhus/mem)\n\n> [Memoize](https://en.wikipedia.org/wiki/Memoization) functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input\n\nMemory is automatically released when an item expires.\n\n\n## Install\n\n```\n$ npm install mem\n```\n\n\n## Usage\n\n```js\nconst mem = require('mem');\n\nlet i = 0;\nconst counter = () => ++i;\nconst memoized = mem(counter);\n\nmemoized('foo');\n//=> 1\n\n// Cached as it's the same arguments\nmemoized('foo');\n//=> 1\n\n// Not cached anymore as the arguments changed\nmemoized('bar');\n//=> 2\n\nmemoized('bar');\n//=> 2\n```\n\n##### Works fine with promise returning functions\n\n```js\nconst mem = require('mem');\n\nlet i = 0;\nconst counter = async () => ++i;\nconst memoized = mem(counter);\n\n(async () => {\n\tconsole.log(await memoized());\n\t//=> 1\n\n\t// The return value didn't increase as it's cached\n\tconsole.log(await memoized());\n\t//=> 1\n})();\n```\n\n```js\nconst mem = require('mem');\nconst got = require('got');\nconst delay = require('delay');\n\nconst memGot = mem(got, {maxAge: 1000});\n\n(async () => {\n\tawait memGot('sindresorhus.com');\n\n\t// This call is cached\n\tawait memGot('sindresorhus.com');\n\n\tawait delay(2000);\n\n\t// This call is not cached as the cache has expired\n\tawait memGot('sindresorhus.com');\n})();\n```\n\n\n## API\n\n### mem(fn, [options])\n\n#### fn\n\nType: `Function`\n\nFunction to be memoized.\n\n#### options\n\nType: `Object`\n\n##### maxAge\n\nType: `number`<br>\nDefault: `Infinity`\n\nMilliseconds until the cache expires.\n\n##### cacheKey\n\nType: `Function`\n\nDetermines the cache key for storing the result based on the function arguments. By default, if there's only one argument and it's a [primitive](https://developer.mozilla.org/en-US/docs/Glossary/Primitive), it's used directly as a key, otherwise it's all the function arguments JSON stringified as an array.\n\nYou could for example change it to only cache on the first argument `x => JSON.stringify(x)`.\n\n##### cache\n\nType: `Object`<br>\nDefault: `new Map()`\n\nUse a different cache storage. Must implement the following methods: `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()`. You could for example use a `WeakMap` instead or [`quick-lru`](https://github.com/sindresorhus/quick-lru) for a LRU cache.\n\n##### cachePromiseRejection\n\nType: `boolean`<br>\nDefault: `false`\n\nCache rejected promises.\n\n### mem.clear(fn)\n\nClear all cached data of a memoized function.\n\n#### fn\n\nType: `Function`\n\nMemoized function.\n\n\n## Tips\n\n### Cache statistics\n\nIf you want to know how many times your cache had a hit or a miss, you can make use of [stats-map](https://github.com/SamVerschueren/stats-map) as a replacement for the default cache.\n\n#### Example\n\n```js\nconst mem = require('mem');\nconst StatsMap = require('stats-map');\nconst got = require('got');\n\nconst cache = new StatsMap();\nconst memGot = mem(got, {cache});\n\n(async () => {\n\tawait memGot('sindresorhus.com');\n\tawait memGot('sindresorhus.com');\n\tawait memGot('sindresorhus.com');\n\n\tconsole.log(cache.stats);\n\t//=> {hits: 2, misses: 1}\n})();\n```\n\n\n## Related\n\n- [p-memoize](https://github.com/sindresorhus/p-memoize) - Memoize promise-returning & async functions\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
  "readmeFilename": "readme.md",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/sindresorhus/mem.git"
  },
  "scripts": {
    "test": "xo && ava"
  },
  "version": "4.0.0"
}
