{"_id":"then-callback","_rev":"24-660ba463323b2b426c72638fcbe95e28","name":"then-callback","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","dist-tags":{"latest":"1.0.3"},"versions":{"0.0.0":{"name":"then-callback","version":"0.0.0","description":"Allows you to pass callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1"},"files":["index.js"],"keywords":[],"bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@0.0.0","_shasum":"fe80440264b378dca883f31ed50ccd7e9f15875c","_from":".","_npmVersion":"3.3.2","_nodeVersion":"4.0.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"fe80440264b378dca883f31ed50ccd7e9f15875c","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-0.0.0.tgz","integrity":"sha512-bZY4NDoyfk2/kEZVhvhHrbrAYj9MFzl408rV2bLm7OIVUhhG9PB6kcmzTCT5rMjKotGK9UA7K3ojJNE3x6TqxQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCeRHxx7bQdbuJp0vy5q42POKtjYSMhLYOM9py3WDR9BQIhAOAVYhwMHJ7Pq+y5AP7UmZOpau64f+mzsr80gkPPoRsa"}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"directories":{}},"0.1.0":{"name":"then-callback","version":"0.1.0","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1"},"files":["index.js"],"keywords":[],"gitHead":"58fc052e85349df75d21b95e9371292df8a6fa3f","bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@0.1.0","_shasum":"9ec22001eed2a0c010923cbace0f7874e3e5743d","_from":".","_npmVersion":"3.3.2","_nodeVersion":"4.0.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"9ec22001eed2a0c010923cbace0f7874e3e5743d","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-0.1.0.tgz","integrity":"sha512-kCHh2BkITOqB7pUFr72AlOTOIUBfFvaEHOzWVUSdV9P4QfPdTf36fSFTm4QZCXofXvIOKfcFvueEmtyoBglETg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCQoqZcV/8XQ/ozhs6BSrTlcg8ISnIQMnYhExc0sAAoPAIgc3RPXZA3ldMnwQgbGyCaSxSHGrrE2I4ELV6trmhFyMk="}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"directories":{}},"1.0.0":{"name":"then-callback","version":"1.0.0","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1","redolent":"^1.0.3"},"files":["index.js"],"keywords":["allow","callback","callbackify","cb","free","promise","then","thenify","wrap","wrapper"],"gitHead":"4eead0beea33a3b1ce3376af31c08ca199b7167d","bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@1.0.0","_shasum":"994f2faecf2fea94ae8ccae33911ae9cf49f80c1","_from":".","_npmVersion":"3.3.2","_nodeVersion":"4.0.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"994f2faecf2fea94ae8ccae33911ae9cf49f80c1","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-1.0.0.tgz","integrity":"sha512-n2QY8XNS3SLJRrWq79wgBdU+mWf8A26yVBWCkXPFdo5INVJcAXL5yXBJg4dmyWfHwR/rK156gMVNZ4yhoPu0uw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEWapfi/jwubxdJJlbcIFk6oYxX274k5KyBikTTBinQ6AiEA/l7nplhv5CfAAnKvDEvp+rKYQBRrqigpNVvDYZ/+lGs="}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"directories":{}},"1.0.1":{"name":"then-callback","version":"1.0.1","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1","redolent":"^1.0.3"},"files":["index.js"],"keywords":["allow","callback","callbackify","cb","free","promise","then","thenify","wrap","wrapper"],"gitHead":"349c111e4b6923c88de1344da8a10d50b06fa465","bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@1.0.1","_shasum":"57bc30152dde10810ee7355ddf8f7142a1bd5418","_from":".","_npmVersion":"3.3.2","_nodeVersion":"4.0.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"57bc30152dde10810ee7355ddf8f7142a1bd5418","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-1.0.1.tgz","integrity":"sha512-6j0jmsNRPkvCsJm5w4lOeLntZEEqel7qZ4s94NT+c9Z2ail5v262MdlQeh0WCC3E0xZ3CvLv8ZIEGLb6FltNLg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCptgIWVFHd24dIKunJQILii5x2MuboZVCETazFZUoyUQIhAOqvAQVevCCTxYd67jCOH5n5Fwc4Ygoe5oC/b0CX0M+A"}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"directories":{}},"1.0.2":{"name":"then-callback","version":"1.0.2","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1","redolent":"^1.0.3"},"files":["index.js"],"keywords":["allow","callback","callbackify","cb","free","promise","then","thenify","wrap","wrapper"],"gitHead":"424477c13faaa000858390fec3968d98dc91e841","bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@1.0.2","_shasum":"02b06502d35910bdf927e656c5a61b08ea20539e","_from":".","_npmVersion":"3.5.3","_nodeVersion":"5.4.1","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"02b06502d35910bdf927e656c5a61b08ea20539e","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-1.0.2.tgz","integrity":"sha512-UElgozOHJPkPcH1fsGqrljyWXFwUlm5rSx5R8lwcJCtEPb3ZGCqsZDp/L6XPO1A6qhEcbLV0/QvKOrrHECa9rw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDRq0qQFJ39mUEM8lW+kgQvoZ49lMYmyB3rPuI8qcZGIwIgKCzYzIz4/9qR2oWE26SneLJUIqnC3C9VT8RnJuZMePc="}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"directories":{}},"1.0.3":{"name":"then-callback","version":"1.0.3","description":"Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`","repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"precommit.silent":true,"main":"index.js","license":"MIT","scripts":{"test":"standard && node test.js"},"dependencies":{"is-promise":"^2.1.0"},"devDependencies":{"assertit":"^0.1.0","native-or-another":"^3.0.1","pre-commit":"^1.1.2","redolent":"^1.0.3"},"files":["index.js"],"keywords":["allow","callback","callbackify","cb","free","promise","then","thenify","wrap","wrapper"],"gitHead":"eb3b2faeeb4f2ea2068b369d0ced3237634ecd4e","bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"homepage":"https://github.com/hybridables/then-callback#readme","_id":"then-callback@1.0.3","_shasum":"d8bd1d6a37061a59220f359c53e4e44f58dbb4ac","_from":".","_npmVersion":"3.8.2","_nodeVersion":"5.8.0","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"dist":{"shasum":"d8bd1d6a37061a59220f359c53e4e44f58dbb4ac","tarball":"https://registry.npmjs.org/then-callback/-/then-callback-1.0.3.tgz","integrity":"sha512-sxrmH0+ChIB4TeqJYUHymEitUFN42jrHWdbfIPPecWxkrXmp12IIsfC9cUfe7WpyKlkubkEqs30FyLDXlH8Orw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICWT65HiKyXqS+8zRyO8ed2TJRPuWe0fbkVJZbhcj6eYAiB8OoqhbiCDzhnD5+5ZgQlX1tdMhV26bZcXkHRkivbt2w=="}]},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"_npmOperationalInternal":{"host":"packages-13-west.internal.npmjs.com","tmp":"tmp/then-callback-1.0.3.tgz_1458236463249_0.8428004435263574"},"directories":{}}},"readme":"# [then-callback][author-www-url] [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] \n\n> Wrap a promise to allow passing callback to `.then` of given promise, also works as normal `.then`\n\n[![code climate][codeclimate-img]][codeclimate-url] [![standard code style][standard-img]][standard-url] [![travis build status][travis-img]][travis-url] [![coverage status][coveralls-img]][coveralls-url] [![dependency status][david-img]][david-url]\n\n\n## Install\n```\nnpm i then-callback --save\n```\n\n\n## Usage\n> For more use-cases see the [tests](./test.js)\n\n### [thenCallback](./index.js#L43)\n> Basically, you just pass a promise and it returns promise, but `.then` from the returned promise can accept a callback function, instead of two arguments as usual - one for result, one for error.  \nNotice that it also works as normal `.then` if you pass two arguments.\n\n- `<promise>` **{Promise}**\n- `return` **{Promise}**\n\n**Example**\n\n```js\nconst thenCallback = require('then-callback')\nconst promise = Promise.resolve(123)\n\nthenCallback(promise).then((err, res) => {\n  console.log('err:', err) // => null\n  console.log('res:', res) // => 123\n})\n\n// but also works as normal `.then`\nthenCallback(promise).then((res) => {\n  console.log('res:', res) // => 123\n}, (err) => {\n  console.log('err:', err)\n})\n```\n\nYou just need to wrap a promise, then you can use `.then` as usual, or to pass callback-style function to it as first argument.\n\n**Example**\n\n```js\nconst fs = require('fs')\nconst redolent = require('redolent')\nconst readFile = redolent(fs.readFile)\nconst thenCallback = require('then-callback')\n\nconst thenCallback = require('then-callback')\nvar promise = readFile('package.json', 'utf8')\npromise = thenCallback(promise)\n\npromise.then((err, res) => {\n  if (err) return console.error(err)\n  console.log(JSON.parse(res).name) //=> 'then-callback'\n})\n```\n\nOtherwise, if you pass two arguments and second is function, it will work as normal `.then`.\n\n**Example**\n\n```js\nconst thenCallback = require('then-callback')\nconst NativePromise = require('native-or-another')()\n\n// rejected promise\nvar promise = NativePromise.reject(new Error('foo bar'))\nthenCallback(promise).then(console.log, console.error) //=> Error: foo bar\n\n// resolved promise\nvar promise = NativePromise.resolve(123)\nthenCallback(promise).then(console.log, console.error) //=> '123'\n```\n\n\n## Related\n- [always-promise](https://github.com/hybridables/always-promise): Promisify, basically, everything. Generator function, callback-style or synchronous function; sync function that returns child process, stream or observable; directly passed promise, stream or child process.\n- [letta](https://github.com/hybridables/letta): Let's move to promises! Drop-in replacement for `co@4`, but on steroids. Accepts sync, async and generator functions.\n- [native-or-another](https://github.com/tunnckoCore/native-or-another): Always will expose native `Promise` if available, otherwise `Bluebird` but only if you don't give another promise module like `q` or `promise` or what you want.\n- [native-promise](https://github.com/tunnckoCore/native-promise): Get native `Promise` or falsey value if not available.\n\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/hybridables/then-callback/issues/new).  \nBut before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines.\n\n\n## [Charlike Make Reagent](http://j.mp/1stW47C) [![new message to charlike][new-message-img]][new-message-url] [![freenode #charlike][freenode-img]][freenode-url]\n\n[![tunnckocore.tk][author-www-img]][author-www-url] [![keybase tunnckocore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url]\n\n\n[npmjs-url]: https://www.npmjs.com/package/then-callback\n[npmjs-img]: https://img.shields.io/npm/v/then-callback.svg?label=then-callback\n\n[license-url]: https://github.com/hybridables/then-callback/blob/master/LICENSE.md\n[license-img]: https://img.shields.io/badge/license-MIT-blue.svg\n\n\n[codeclimate-url]: https://codeclimate.com/github/hybridables/then-callback\n[codeclimate-img]: https://img.shields.io/codeclimate/github/hybridables/then-callback.svg\n\n[travis-url]: https://travis-ci.org/hybridables/then-callback\n[travis-img]: https://img.shields.io/travis/hybridables/then-callback.svg\n\n[coveralls-url]: https://coveralls.io/r/hybridables/then-callback\n[coveralls-img]: https://img.shields.io/coveralls/hybridables/then-callback.svg\n\n[david-url]: https://david-dm.org/hybridables/then-callback\n[david-img]: https://img.shields.io/david/hybridables/then-callback.svg\n\n[standard-url]: https://github.com/feross/standard\n[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n\n\n[author-www-url]: http://www.tunnckocore.tk\n[author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg\n\n[keybase-url]: https://keybase.io/tunnckocore\n[keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg\n\n[author-npm-url]: https://www.npmjs.com/~tunnckocore\n[author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg\n\n[author-twitter-url]: https://twitter.com/tunnckoCore\n[author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg\n\n[author-github-url]: https://github.com/tunnckoCore\n[author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg\n\n[freenode-url]: http://webchat.freenode.net/?channels=charlike\n[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg\n\n[new-message-url]: https://github.com/tunnckoCore/ama\n[new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg","maintainers":[{"email":"super.ludiq@gmail.com","name":"vanchoy"},{"email":"mameto2011@gmail.com","name":"tunnckocore"}],"time":{"modified":"2022-06-27T06:02:39.077Z","created":"2015-10-10T19:59:04.394Z","0.0.0":"2015-10-10T19:59:04.394Z","0.1.0":"2015-10-10T21:09:08.660Z","1.0.0":"2015-10-10T21:21:58.717Z","1.0.1":"2015-10-10T21:31:45.284Z","1.0.2":"2016-01-17T08:51:15.154Z","1.0.3":"2016-03-17T17:41:05.742Z"},"homepage":"https://github.com/hybridables/then-callback#readme","keywords":["allow","callback","callbackify","cb","free","promise","then","thenify","wrap","wrapper"],"repository":{"type":"git","url":"git+https://github.com/hybridables/then-callback.git"},"author":{"name":"Charlike Mike Reagent","email":"@tunnckoCore","url":"http://www.tunnckocore.tk"},"bugs":{"url":"https://github.com/hybridables/then-callback/issues"},"license":"MIT","readmeFilename":"README.md"}