{"_id":"2-thenable","_rev":"1-3fd164bf012b00aa5d88bfc912cb7414","name":"2-thenable","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"2-thenable","version":"1.0.0","description":"Convert any object to thenable","author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"keywords":["async","promise","thenable","then"],"repository":{"type":"git","url":"git+https://github.com/medikoo/2-thenable.git"},"dependencies":{"d":"1","es5-ext":"^0.10.47"},"devDependencies":{"chai":"^4.2","eslint":"^5.12","eslint-config-medikoo":"^2","mocha":"^5.2","nyc":"^13.1"},"eslintConfig":{"extends":"medikoo","root":true,"env":{"node":true},"overrides":[{"files":"test/**/*.js","env":{"mocha":true}}]},"scripts":{"coverage":"nyc --reporter=lcov --reporter=html --reporter=text-summary npm test","check-coverage":"npm run coverage && nyc check-coverage --statements 80 --function 80 --branches 50 --lines 80","lint":"eslint --ignore-path=.gitignore .","test":"mocha"},"license":"ISC","gitHead":"c7c24876e5858a93f5d021b978576dfbe288ae10","bugs":{"url":"https://github.com/medikoo/2-thenable/issues"},"homepage":"https://github.com/medikoo/2-thenable#readme","_id":"2-thenable@1.0.0","_npmVersion":"6.5.0-next.0","_nodeVersion":"11.6.0","_npmUser":{"name":"medikoo","email":"medikoo+npm@medikoo.com"},"dist":{"integrity":"sha512-HqiDzaLDFCXkcCO/SwoyhRwqYtINFHF7t9BDRq4x90TOKNAJpiqUt9X5lQ08bwxYzc067HUywDjGySpebHcUpw==","shasum":"56e9a2e363293b1e507f501aac1aa9927670b2fc","tarball":"https://registry.npmjs.org/2-thenable/-/2-thenable-1.0.0.tgz","fileCount":7,"unpackedSize":7005,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcP1ZNCRA9TVsSAnZWagAAGsEP/R//nw5k7/XLZVg915hW\nB2TseejlSvL4aWdB5SSgV7T905BWJ15hn3ceya4pnO84Shof+58WzohQgzdh\nKB/6Ld/iJlb0MUDaBEGu7D+mVlgny6zAgRVnJNrOx9S4x1enUiWZGuFqDjc+\nxaVJ1OWvvW5e+lHUDml/1jsgkqsfcrz8J67KqwhZDC9iF4ZL+yKWE4Km0RBT\nJV3c5Dgqlo+vc6qWcU3tOt/ACmFT+TDyaEO908729iGsd6zQca5KaWyiTCm1\ntIten3leAFnRK7SxjD8SofFTTywqPp8euYnIJFKTzDBHYLHCjykZtedNmezz\neZKDxP+zvUu5HHVvSxe56vZ649lnjgMdhdLMkWp7EtDTHZlqF+iSwQVUoiZL\nClGJ5l+9sAtYCg4OhjG1jomp0c0yELZJ/vH8SW+A8g1+BGvW9ZnRCc2JFiQo\nYEz8WUoMuJ4iIC4wxgGjf1lgzzFoOVeA5R9IOEv6jKatDxI/hbvp1knCpdUP\nWELHYpvX6K01i7ygmDh8Zehnrum5T7PMkMDncw5m93iF7Dt0+Zze/ZYBhPbL\n9cHjxJ7KGl9jJH1Qo93tv+l3RvBvleHE0js9Oi7lxtNtCcLm8NqZBbxtgYjY\nArlqbXqVUJsshsmhTaIzIM2EtV/fjmTAbEYDUj5eJ88RDGftAbNgBYNFOHI3\nAO/w\r\n=2lAZ\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEAQpDnar4yCCc4vM1zPiudLRxr0r3cVc3L+vzUjJgs/AiA02ee6Ivna+XR0/K3ksZitFGR1qBek34GX0WNNzvoiVQ=="}]},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/2-thenable_1.0.0_1547654732807_0.12797307337704567"},"_hasShrinkwrap":false}},"time":{"created":"2019-01-16T16:05:32.807Z","1.0.0":"2019-01-16T16:05:32.932Z","modified":"2022-04-04T10:17:13.782Z"},"maintainers":[{"name":"medikoo","email":"medikoo+npm@medikoo.com"}],"description":"Convert any object to thenable","homepage":"https://github.com/medikoo/2-thenable#readme","keywords":["async","promise","thenable","then"],"repository":{"type":"git","url":"git+https://github.com/medikoo/2-thenable.git"},"author":{"name":"Mariusz Nowak","email":"medyk@medikoo.com","url":"http://www.medikoo.com/"},"bugs":{"url":"https://github.com/medikoo/2-thenable/issues"},"license":"ISC","readme":"[![*nix build status][nix-build-image]][nix-build-url]\n[![Windows build status][win-build-image]][win-build-url]\n[![Tests coverage][cov-image]][cov-url]\n![Transpilation status][transpilation-image]\n\n# 2-thenable\n\n## Convert object into a thenable\n\nUseful when we want to imply an asynchronous representation onto some non-promise object.\n\nHaving that target object can be combined into promise chains or async/await syntax.\nOne use case would be turning a stream instance so it's also a promise.\n\n### Installation\n\n```bash\nnpm install 2-thenable\n```\n\n### How it works\n\nUtility takes `target` and `promise` arguments. `target` is object to be extended with `then`, `catch` and `finally` methods.\nWhile `promise` is expected to be a native promise instance that reflects resolution which should be mapped onto `target`\n\n# Usage\n\nExample of converting stream to thenable\n\n```javascript\nconst toThenable = require(\"2-thenable\");\n\n// Example of converting a simple utf8 string stream to thenable\ntoThenable(stream, new Promise((resolve, reject) => {\n\tlet result = '';\n\tstream.on('error', reject);\n\tstream.on('data', data => (result += data));\n\tstream.on('end', () => resolve(result));\n});\n\nstream.then(result => {\n\tconsole.log(\"Cumulated string data\", result);\n});\n```\n\n### Tests\n\n```bash\nnpm test\n```\n\n[nix-build-image]: https://semaphoreci.com/api/v1/medikoo-org/2-thenable/branches/master/shields_badge.svg\n[nix-build-url]: https://semaphoreci.com/medikoo-org/2-thenable\n[win-build-image]: https://ci.appveyor.com/api/projects/status/?svg=true\n[win-build-url]: https://ci.appveyor.com/api/project/medikoo/2-thenable\n[cov-image]: https://img.shields.io/codecov/c/github/medikoo/2-thenable.svg\n[cov-url]: https://codecov.io/gh/medikoo/2-thenable\n[transpilation-image]: https://img.shields.io/badge/transpilation-free-brightgreen.svg\n[npm-image]: https://img.shields.io/npm/v/2-thenable.svg\n","readmeFilename":"README.md"}