{"name":"time-limit-promise","version":"1.0.0","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","devDependencies":{"mocha":"^2.3.4","pinkie-promise":"^2.0.0"},"gitHead":"a6d4e1a7e282480d429052518466215da661f387","_id":"time-limit-promise@1.0.0","_shasum":"a86e0da54544ea8f42f1ce17b918a18bc70eb010","_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":"a86e0da54544ea8f42f1ce17b918a18bc70eb010","tarball":"http://registry-npm.ywwl.com/time-limit-promise/download/time-limit-promise-1.0.0.tgz","integrity":"sha512-nKtRubgpIF1hUzXLe657Q1cH8Tff+qFtHpanVy1UrWcIgScBUULLtVoTeFMBVD0CnQMF05MNJh4D8QWoBwUh6g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIHwcc+m13AOR1zf6PBl9bPgJvNMmYFqIDkgcyil9w0IOAiEAna0od0UagNYqVEOY4/B38Oun8bMQfY3iBQwnnBTyWR8="}],"size":2657,"noattachment":false,"key":"/time-limit-promise/-/time-limit-promise-1.0.0.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":1449169222330,"_cnpm_publish_time":1449169222330,"dist-tags":{"latest":"1.0.4"}}