{"name":"time-limit-promise","version":"1.0.4","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":"4a00961ea115e8f9f6682b201914358e455afbf6","_id":"time-limit-promise@1.0.4","_npmVersion":"6.0.1","_nodeVersion":"8.11.1","_npmUser":{"name":"inikulin","email":"ifaaan@gmail.com"},"dist":{"integrity":"sha512-FLHDDsIDducw7MBcRWlFtW2Tm50DoKOSFf0Nzx17qwXj8REXCte0eUkHrJl9QU3Bl9arG3XNYX0PcHpZ9xyuLw==","shasum":"33e928212273c70d52153c28ad2a7e3319b975f9","tarball":"http://registry-npm.ywwl.com/time-limit-promise/download/time-limit-promise-1.0.4.tgz","fileCount":4,"unpackedSize":4358,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbK4AzCRA9TVsSAnZWagAAw+4P/1jTHzl9NmWMQQ3MrC4s\nOtLgKE9ImQJRFbuXRMcU8+jRxYKuJCJeBZzPifckfe8gSURVce12ZHYpK7hE\nrpEnbLn/Km/umubHtFYFGsIYX35iIe0gw+2kA1nIPben8y6p9lE1Xk16DBdX\nTg8AAqOootRIKIK7X0QU3NOI+QRg1oVt0LcVKr5kKuLOwMS+GpFJv2slNEzr\nPkhq8u9NiYbgYgenKffsDXwnrYmtGzuh/4wK3XgQ2l2IrUaSvivprDz+EXH4\nW2kugdH/H2fJLNltyFasRPiKpqbrC6Ic9ULnjKE0VONQlxbsqkZ4QbK6rtKv\nJTGCbA6dDTxHDWWtD9HvpYJ8IjWVgz+RfD1L0fYyD0vOIqBz9PvYpNFfkZ46\neqZM6WzMC4kbFdmra8ZUjg73Cymdww7A24gs9elz25Dc628prwbXqFE9Ak4P\n6XXp2+9n7fCOn10QHzyGi2hO/UUCxUcSB/w2U9fs2PlWyp7B2FNvWopOmJJi\nthEvBt8NfJ94EbAsyvmX6nab4tlehIAYqDSjsDIsSQ81jBK8ZwpktpK3RMz8\nFuS6N+ejc37MAljc8W1YVJ+DwMs55L2uQmQ7od/wG1RywaKiVp4a6YrcFpMy\nD+Hezopdt1fqnKrTt809rpE8q/r0Kee0BC+DV2y6qlaxkH/zNJlp+pjkP3/S\nND+S\r\n=u4/R\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGB2yr9bahuO4q15soJI7Ry6tlT+6KbS3YwDZ1FnZvkoAiEAubR0s1/9Dujal5OGY+vXzYf2dp07mzI/2StXgrdzxj8="}],"size":2020,"noattachment":false,"key":"/time-limit-promise/-/time-limit-promise-1.0.4.tgz"},"maintainers":[{"name":"inikulin","email":"ifaaan@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/time-limit-promise_1.0.4_1529577522324_0.77899079760619"},"_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":1529577522399,"_cnpm_publish_time":1529577522399,"dist-tags":{"latest":"1.0.4"}}