{"name":"time-limit-promise","version":"1.0.3","description":"Fulfill long runinng promises on timeout.","main":"./index.js","scripts":{"test":"mocha"},"repository":{"type":"git","url":"git+https://github.com/inikulin/time-limit-promise.git"},"keywords":["promise","timeout","time","timer","limit","resolve","reject"],"author":{"name":"Ivan Nikulin","url":"ifaaan@gmail.com, https://github.com/inikulin"},"license":"MIT","bugs":{"url":"https://github.com/inikulin/time-limit-promise/issues"},"homepage":"https://github.com/inikulin/time-limit-promise#readme","files":["index.js"],"engines":{"node":">= 0.12"},"devDependencies":{"mocha":"^2.3.4"},"gitHead":"08d0a671f8caa9a4117d44a4f55e39e1afbdfacf","_id":"time-limit-promise@1.0.3","_npmVersion":"6.0.1","_nodeVersion":"8.11.1","_npmUser":{"name":"inikulin","email":"ifaaan@gmail.com"},"dist":{"integrity":"sha512-+0FBZPycPPgHi938ZUWrUo109SoiNm9Q2phunDBaf6Hq3RgALLTkSH5s6kM58+81obl3fNLpBozwvPw+m5MM4A==","shasum":"a3cbfd01cc452b33d847c9b7736b81645bd5b45e","tarball":"http://registry-npm.ywwl.com/time-limit-promise/download/time-limit-promise-1.0.3.tgz","fileCount":4,"unpackedSize":4174,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbBa+bCRA9TVsSAnZWagAAC9gP/iEtlN0PetGPU9QlC+s0\nZiwMYFgKsrlC75av/b36DzV3n9dvnAyKEduRsamxkQ0I0El4xnMIxdscvZx1\nby7QxxPWZFK7livIcS/Si0ACt8D+YUCWQxpFHo5clXZ7OGxkBrMH03zpaDJz\nMAAP35y8MowIPx5TFaFs5l0QUogntsS7mFKOZ2KNopmOab4l4h//bX96him3\nKYQD/0r4n3qi3cEHIjwkuC5K/rpal86SBZ1y7tUI+kpszKIpHskfHH0XMskb\nGs8Ae0sGc5H5oPHpJLUH3ttTx3QV34w0BM75hq4TtT0sPSn18yDaNNkR/gTq\nxhfY+eh6FKlRT8tNwGjZ/WeB3eCjge5JyCGqKtJaNt58oISO+xvPQV09+xIo\nix5kOYORX6zhU+hQzc8quWAdnNwImqDnojsIEBnzVkQCytPo48c9k5hbZgYr\ntKRgB6VTkzgbkCc25GxXLTH5w1wZ8mchUuUFCO4S7s4D4VNP+IoJVJpcP64B\nUiZPRJ5IHvlBtDYg959gXqh1cFW0vzdzyclzV1n4vOFeVIOupFfEliUJpKeU\nBYbomn9791q4idAAgpK0VAl2U3ntDQMN/6A0n02LYM3OBhUzHj0/TSxNuUq3\nUjOqyj6aau8Wjzxp2udKHZnbap/ls2xYNW6omHLsNLF5tHTaeIllhVIVAm8w\nEfvg\r\n=H3z6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCmRiN4GMegrdOT9LovriFcDOG5iGMYPXxoXSMbUGyyJwIgKM+4heZxDRG2PaO4PH+TzJ4o5KKhoQD4lfFD8wTlKV0="}],"size":1976,"noattachment":false,"key":"/time-limit-promise/-/time-limit-promise-1.0.3.tgz"},"maintainers":[{"name":"inikulin","email":"ifaaan@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/time-limit-promise_1.0.3_1527099290552_0.0711592553330398"},"_hasShrinkwrap":false,"readme":"# time-limit-promise\n[![Build Status](https://api.travis-ci.org/inikulin/time-limit-promise.svg)](https://travis-ci.org/inikulin/time-limit-promise)\n\n*Fulfill long runinng promises on timeout.*\n\nUnlike other implementations on npm it has some nice extra features:\n - You can both reject and resolve promises on timeout\n - You can provide custom value with which promise will be rejected or resolved on timeout\n - Unrefs promise timer, so it will not block your app from exit.\n - Uses `Promise` implementation of the passed promise: no external implementation dependencies, no global `Promise` dependencies\n\n## Install\n```\nnpm install time-limit-promise\n```\n\n## Usage\n```js\nconst timeLimit = require('time-limit-promise');\nconst fetch     = require('node-fetch');\n\nvar fetchPromise = fetch('https://github.com/inikulin');\n\ntimeLimit(fetchPromise, 50).then(res => {\n    // If `fetchPromise` will be fulfilled within 50ms\n    // time limited promise will be fullfilled as well.\n    // Otherwise, it will be resolved with the `undefined` value.\n});\n\ntimeLimit(fetchPromise, 50, { resolveWith: 'no content' }).then(res => {\n    // Same as above, but on timeout it will\n    // be resolved with the `no-content` value.\n    console.log(res); // > no-content\n});\n\n\ntimeLimit(fetchPromise, 50, { rejectWith: new Error('timeout') }).catch(err => {\n    // Same as above, but on timeout it will\n    // be rejected with the provided error.\n    console.log(err.message); // > timeout\n});\n\n```\n\n## Author\n[Ivan Nikulin](https://github.com/inikulin) (ifaaan@gmail.com)\n","publish_time":1527099290663,"_cnpm_publish_time":1527099290663,"dist-tags":{"latest":"1.0.4"}}