{"name":"handle-callback","version":"1.0.1","description":"Initial step for creating hybrid APIs, used by `hybridify`. Handle callback in promise - give promise and callback return promise.","scripts":{"lint":"jshint index.js && jscs index.js --reporter inline","test":"mocha","test-cov":"istanbul cover _mocha","test-travis":"istanbul cover _mocha --report lcovonly"},"author":{"name":"Charlike Make Reagent","email":"mameto_100@mail.bg","url":"https://github.com/tunnckoCore"},"repository":{"type":"git","url":"git://github.com/tunnckoCore/handle-callback.git"},"keywords":["api","apis","aplus","args","argument","arguments","bluebird","callback","callbacks","cb","handle","handle-callback","hybrid","hybrid-apis","hybridify","promise","promises","promises-aplus","then"],"license":{"type":"MIT","url":"https://github.com/tunnckoCore/handle-callback/blob/master/license.md"},"dependencies":{"is-promise":"^1.0.1"},"devDependencies":{"bluebird":"^2.8.2","istanbul-harmony":"^0.3.1","mocha":"*","mocha-lcov-reporter":"^0.0.1","then-got":"^1.0.2"},"gitHead":"0c2f71bcc0c7f9627eb8f227aa7d55c9f86e9ac3","bugs":{"url":"https://github.com/tunnckoCore/handle-callback/issues"},"homepage":"https://github.com/tunnckoCore/handle-callback","_id":"handle-callback@1.0.1","_shasum":"87b669387f3c3ad8882191fd45be1342ca073b47","_from":".","_npmVersion":"2.1.16","_nodeVersion":"0.11.14","_npmUser":{"name":"tunnckocore","email":"mameto_100@mail.bg"},"maintainers":[{"name":"tunnckocore","email":"mameto_100@mail.bg"}],"dist":{"shasum":"87b669387f3c3ad8882191fd45be1342ca073b47","tarball":"http://registry-npm.ywwl.com/handle-callback/download/handle-callback-1.0.1.tgz","integrity":"sha512-PZjPdiyjiGuClH5xLcwzAPJtg7hJ+2hlsxhujp1J3Jz06lNlym1pM8Si5g1+CGeUJ8X8KGHyyrh+pSSh9ky6Qw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzL91hDbN4YlzVY/bR5NkZoD6HTWLV77fUvtT2cPO/LgIhAMth1FUrHSyKbDS3wXZ+a7RpX6MtEEq4KPsQJfa8reLF"}],"size":5700,"noattachment":false,"key":"/handle-callback/-/handle-callback-1.0.1.tgz"},"directories":{},"readme":"# handle-callback [![npmjs.com][npmjs-img]][npmjs-url] [![The MIT License][license-img]][license-url] \n\n> Make promise to have support for callback api, it returns promise in that same time.\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 handle-callback --save\nnpm test\n```\n\n\n## Usage\n> For more use-cases see the [tests](./test.js)\n\n```js\nvar handleCallback = require('handle-callback')\nvar got = require('then-got')\n\nfunction hybridGot (url, callback) {\n  var promise = got(url)\n\n  if (callback) {\n    promise = handleCallback(promise, callback)\n  }\n\n  return promise\n}\n\nhybridGot('https://github.com')\n.then(function (res) {\n  console.log(res[0])\n  //=> html content of the page\n})\n.catch(console.error)\n\n// or both in same time\nhybridGot('https://github.com', function (err, res) {\n  console.log(err) //=> null\n  console.log(res[0]) //=> html of page\n})\n.then(function (res) {\n  console.log(res[0]) //=> html of page\n})\n.catch(console.error)\n```\n\n\n## Related\n- [make-callback](https://github.com/tunnckocore/make-callback): Make synchronous function to support callback api\n- [always-callback](https://github.com/tunnckocore/always-callback): Create callback api for given sync function. Guarantee that given function (sync or async, no matter) will always have callback api and will handle errors correctly.\n- [always-promise](https://github.com/tunnckocore/always-promise): Create Bluebird Promise from given async or synchronous function. It automatically convert sync functions to async, then to promise.\n- [hybridify](https://github.com/hybridables/hybridify): Building hybrid APIs. You can use both callback and promise in same time.\n- [handle-arguments](https://github.com/hybridables/handle-arguments): Handles given Arguments object - return separatly last argument (commonly callback) and other arguments as Array. Useful in node-style callback flow.\n- [manage-arguments](https://github.com/tunnckocore/manage-arguments): Prevents arguments leakage - managing arguments. From Optimization killers by Petka Antonov.\n- [promise2thunk](https://github.com/tunnckocore/promise2thunk): Convert (transform) promise to thunk, just like was in co@3\n\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/hybridables/handle-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/handle-callback\n[npmjs-img]: https://img.shields.io/npm/v/handle-callback.svg?label=handle-callback\n\n[license-url]: https://github.com/hybridables/handle-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/handle-callback\n[codeclimate-img]: https://img.shields.io/codeclimate/github/hybridables/handle-callback.svg\n\n[travis-url]: https://travis-ci.org/hybridables/handle-callback\n[travis-img]: https://img.shields.io/travis/hybridables/handle-callback.svg\n\n[coveralls-url]: https://coveralls.io/r/hybridables/handle-callback\n[coveralls-img]: https://img.shields.io/coveralls/hybridables/handle-callback.svg\n\n[david-url]: https://david-dm.org/hybridables/handle-callback\n[david-img]: https://img.shields.io/david/hybridables/handle-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/messages\n[new-message-img]: https://img.shields.io/badge/send%20me-message-green.svg\n","publish_time":1421812745451,"_cnpm_publish_time":1421812745451,"dist-tags":{"latest":"2.0.0"}}