{"name":"time-limit-promise","version":"1.0.1","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"],"devDependencies":{"mocha":"^2.3.4","pinkie-promise":"^2.0.0"},"gitHead":"a6d4e1a7e282480d429052518466215da661f387","_id":"time-limit-promise@1.0.1","_shasum":"d69881cdd41362a024aa9119279fb35964ae3db3","_from":".","_npmVersion":"2.14.7","_nodeVersion":"4.2.1","_npmUser":{"name":"inikulin","email":"ifaaan@gmail.com"},"maintainers":[{"name":"inikulin","email":"ifaaan@gmail.com"}],"dist":{"shasum":"d69881cdd41362a024aa9119279fb35964ae3db3","tarball":"http://registry-npm.ywwl.com/time-limit-promise/download/time-limit-promise-1.0.1.tgz","integrity":"sha512-WMexbwOo68iwtY21bNcBKxRuCJoL4J6HVRxukdkXDsRR2zGPZnowOiV/CDOJf8C6itkRVyfZO2q8QMNfv28Gnw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDXeH9WmYQfIteI0Jsn7qY27ddHZD7q3qd3mCboCR+u3AiBQRsyOMLLTeJ6guJ2bkRDEDd4uD5/qoRYx6UWvrzQkRg=="}],"size":1977,"noattachment":false,"key":"/time-limit-promise/-/time-limit-promise-1.0.1.tgz"},"directories":{},"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":1449169254473,"_cnpm_publish_time":1449169254473,"dist-tags":{"latest":"1.0.4"}}