{
  "manifest": {
    "name": "thunky",
    "version": "1.1.0",
    "description": "delay the evaluation of a paramless async function and cache the result",
    "main": "index.js",
    "devDependencies": {
      "standard": "^12.0.1",
      "tape": "^4.9.1"
    },
    "repository": {
      "type": "git",
      "url": "git://github.com/mafintosh/thunky.git"
    },
    "scripts": {
      "test": "standard && tape test.js"
    },
    "keywords": [
      "memo",
      "thunk",
      "async",
      "lazy",
      "control",
      "flow",
      "cache"
    ],
    "author": {
      "name": "Mathias Buus Madsen",
      "email": "mathiasbuus@gmail.com"
    },
    "bugs": {
      "url": "https://github.com/mafintosh/thunky/issues"
    },
    "homepage": "https://github.com/mafintosh/thunky#readme",
    "license": "MIT",
    "_registry": "npm",
    "_loc": "/homez.1033/heliovt/.cache/yarn/v6/npm-thunky-1.1.0-5abaf714a9405db0504732bbccd2cedd9ef9537d-integrity/node_modules/thunky/package.json",
    "readmeFilename": "README.md",
    "readme": "# thunky\n\nDelay the evaluation of a paramless async function and cache the result (see [thunk](http://en.wikipedia.org/wiki/Thunk_%28functional_programming%29)).\n\n```\nnpm install thunky\n```\n\n[![build status](http://img.shields.io/travis/mafintosh/thunky.svg?style=flat)](http://travis-ci.org/mafintosh/thunky)\n\n## Example\n\nLet's make a simple function that returns a random number 1 second after it is called for the first time\n\n``` js\nvar thunky = require('thunky')\n\nvar test = thunky(function (callback) { // the inner function should only accept a callback\n  console.log('waiting 1s and returning random number')\n  setTimeout(function () {\n    callback(Math.random())\n  }, 1000)\n})\n\ntest(function (num) {  // inner function is called the first time we call test\n  console.log(num) // prints random number\n})\n\ntest(function (num) {  // subsequent calls waits for the first call to finish and return the same value\n  console.log(num) // prints the same random number as above\n})\n```\n\n## Lazy evaluation\n\nThunky makes it easy to implement a lazy evaluation pattern.\n\n``` js\nvar getDb = thunky(function (callback) {\n  db.open(myConnectionString, callback)\n})\n\nvar queryDb = function (query, callback) {\n  getDb(function (err, db) {\n    if (err) return callback(err)\n    db.query(query, callback)\n  })\n}\n\nqueryDb('some query', function (err, result) { ... } )\n\nqueryDb('some other query', function (err, result) { ... } )\n```\n\nThe first time `getDb` is called it will try do open a connection to the database.\nAny subsequent calls will just wait for the first call to complete and then call your callback.\n\nA nice property of this pattern is that it *easily* allows us to pass any error caused by `getDb` to the `queryDb` callback.\n\n## Error → No caching\n\nIf the thunk callback is called with an `Error` object as the first argument it will not cache the result\n\n``` js\nvar fails = thunky(function (callback) {\n  console.log('returning an error')\n  callback(new Error('bad stuff'))\n})\n\nfails(function (err) { // inner function is called\n  console.log(err)\n});\n\nfails(function (err) { // inner function is called again as it returned an error before\n  console.log(err)\n})\n```\n\n## Promise version\n\nA promise version is available as well\n\n``` js\nvar thunkyp = require('thunky/promise')\n\nvar ready = thunkyp(async function () {\n  // ... do async stuff\n  return 42\n})\n\n// same semantics as the callback version\nawait ready()\n```\n\n## License\n\nMIT\n",
    "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2018 Mathias Buus\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"
  },
  "artifacts": [],
  "remote": {
    "resolved": "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz#5abaf714a9405db0504732bbccd2cedd9ef9537d",
    "type": "tarball",
    "reference": "https://registry.yarnpkg.com/thunky/-/thunky-1.1.0.tgz",
    "hash": "5abaf714a9405db0504732bbccd2cedd9ef9537d",
    "integrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA==",
    "registry": "npm",
    "packageName": "thunky",
    "cacheIntegrity": "sha512-eHY7nBftgThBqOyHGVN+l8gF0BucP09fMo0oO/Lb0w1OF80dJv+lDVpXG60WMQvkcxAkNybKsrEIE3ZtKGmPrA== sha1-Wrr3FKlAXbBQRzK7zNLO3Z75U30="
  },
  "registry": "npm",
  "hash": "5abaf714a9405db0504732bbccd2cedd9ef9537d"
}