{"name":"time-limit-promise","version":"1.0.2","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":"cd415431a1b8af4ae2fbd7001fff589b292ada9d","_id":"time-limit-promise@1.0.2","_shasum":"217fdc5c331f11d1b1eb0f828c95f7c29bae5ce4","_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":"217fdc5c331f11d1b1eb0f828c95f7c29bae5ce4","tarball":"http://registry-npm.ywwl.com/time-limit-promise/download/time-limit-promise-1.0.2.tgz","integrity":"sha512-DFE7RpqpQ1qwqbPDg+36gd+LaNypaV3ouPMKAis7dSQ9kXSGhwPmjTELz2EUot/EpChs85IGOJpOB5UPzVV0Kg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCPAUVOzv1b2WjJ19uOqt05YIKaj82uKTfrWpAV+SI7qQIgIpYRc5PTVUlZfTr9bldVfGl9r9GIBdZQa/caUTi7VdQ="}],"size":1964,"noattachment":false,"key":"/time-limit-promise/-/time-limit-promise-1.0.2.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":1449169406000,"_cnpm_publish_time":1449169406000,"dist-tags":{"latest":"1.0.4"}}