{
  "_args": [
    [
      {
        "raw": "mem@4.3.0",
        "scope": null,
        "escapedName": "mem",
        "name": "mem",
        "rawSpec": "4.3.0",
        "spec": "4.3.0",
        "type": "version"
      },
      "/home/zoltan/src/pnpm/pnpm/packages/pnpm"
    ]
  ],
  "_from": "mem@4.3.0",
  "_hasShrinkwrap": false,
  "_id": "mem@4.3.0",
  "_location": "/mem",
  "_nodeVersion": "8.15.0",
  "_npmOperationalInternal": {
    "host": "s3://npm-registry-packages",
    "tmp": "tmp/mem_4.3.0_1554059343791_0.002943299052651671"
  },
  "_npmUser": {
    "name": "sindresorhus",
    "email": "sindresorhus@gmail.com"
  },
  "_npmVersion": "6.9.0",
  "_phantomChildren": {},
  "_requested": {
    "raw": "mem@4.3.0",
    "scope": null,
    "escapedName": "mem",
    "name": "mem",
    "rawSpec": "4.3.0",
    "spec": "4.3.0",
    "type": "version"
  },
  "_requiredBy": [
    "/",
    "/@pnpm/npm-resolver",
    "/@pnpm/tarball-fetcher",
    "/os-locale"
  ],
  "_resolved": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
  "_shasum": "461af497bc4ae09608cdb2e60eefb69bff744178",
  "_shrinkwrap": null,
  "_spec": "mem@4.3.0",
  "_where": "/home/zoltan/src/pnpm/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": "^2.0.0",
    "p-is-promise": "^2.0.0"
  },
  "description": "Memoize functions - An optimization used to speed up consecutive function calls by caching the result of calls with identical input",
  "devDependencies": {
    "ava": "^1.4.1",
    "delay": "^4.1.0",
    "tsd": "^0.7.1",
    "xo": "^0.24.0"
  },
  "directories": {},
  "dist": {
    "integrity": "sha512-qX2bG48pTqYRVmDB37rn/6PT7LcR8T7oAX3bf99u1Tt1nzxYfxkgqDwUwolPlXweM0XzBOBFzSx4kfp7KP1s/w==",
    "shasum": "461af497bc4ae09608cdb2e60eefb69bff744178",
    "tarball": "https://registry.npmjs.org/mem/-/mem-4.3.0.tgz",
    "fileCount": 5,
    "unpackedSize": 9746,
    "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcoRBQCRA9TVsSAnZWagAAibwP/05Hb2MoVvBJVTxbitFu\n64+CmL6LNZTanHNrNSPb6v7sXGFO+uvkjCC/Ebgk7lC9+H0rgUVODnpFSBqd\njXabw0R4FIqLc8Jf1hvZD02+kHwPBRGB9dHs6jP2gMw7WFTM0hArtCKAqEXg\nP21zLIw1yrNp8IatIZMAM/isJjl6MyGdBvDJKb5Zc9og8qiQ3bqHfzCLfBXf\nWCEylAtIT1TNYy20cROpsHBje4xKIWfQCQ1n9J+CqHt/VFiqb0OAGrIY1WCd\n9dh+L3eKdxTlcEejvb7myQCb4O5rCR3pZepJs1wTF5xJRz8RxT8fjvOvSH5O\nITpzt3NbSFDE2FkWPq5I4+Vd1S5I+A1w9kdbcFSnL5nTHVfLEWGZA0IAsdfc\nFMqAjINR9qdW+McQCjKTPUDgKg5OEUvcIhoTpIM47JuGTbUP/Px8DQhqC7Rb\njbjYWRs8d72I2edaNRhgnvJQsrm3f6N7kaPo2/q5gZfpfMPsn9sokrJkXPkA\n9axZaIQ2hpEqQNbctfQinlzIxx5dTjaDSoZ6rQbnHXYN+GjMrKqBanx5PcLg\nJg7Vz7Y29SckUVUUEE2P9/Qgdr+SgsNyN7ZBsSizjONqbwaoi0iAonw2Xp6T\nIf437lRzWSa9iqcvx+zlhkkBf1OU+AdE8nPwYu0Bz9M/bYPWj6Lg8umBRrHe\njaTN\r\n=55DC\r\n-----END PGP SIGNATURE-----\r\n"
  },
  "engines": {
    "node": ">=6"
  },
  "files": [
    "index.js",
    "index.d.ts"
  ],
  "gitHead": "0e9275ea32d5e5343eeab31ceb0271f9f42c85b5",
  "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 && tsd"
  },
  "version": "4.3.0"
}
