{"name":"nodeify","version":"1.0.0","description":"Convert promised code to use node style callbacks","scripts":{"test":"mocha -R spec","prepublish":"npm test"},"repository":{"type":"git","url":"https://github.com/then/nodeify.git"},"keywords":["promise","then","nodeify","callback"],"author":{"name":"ForbesLindesay"},"license":"MIT","devDependencies":{"mocha":"~1.8.1","mocha-as-promised":"~1.2.1","sinon":"~1.6.0"},"dependencies":{"promise":"~1.3.0","is-promise":"~1.0.0"},"_id":"nodeify@1.0.0","dist":{"shasum":"2a106c7bfbd6b8490dd53c130ddbfe2ae639a856","tarball":"http://registry-npm.ywwl.com/nodeify/download/nodeify-1.0.0.tgz","integrity":"sha512-bPTdo/j/ne6lHs+jTOj5e42H+PtbUvRXxdpFYB6rex8zckAfsj1uUGb2383JUPOwX1aW7IIB1ftBZ4TLxJ1yBQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIByp6qSbe/KvZHqfMQQfrJGM3V2dI/CWYwJA1FnShY2EAiEA+2zu7Qr2N0dx20Iv+wvdDdQPXc9RZTw6gK6EhehGrbU="}],"size":2249,"noattachment":false,"key":"/nodeify/-/nodeify-1.0.0.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"}],"directories":{},"readme":"[![Build Status](https://img.shields.io/travis/then/nodeify/master.svg)](https://travis-ci.org/then/nodeify)\n# Nodeify\n\n  Convert promised code to use node style callbacks.  If no callback is provided it will just return the original promise.\n\n## Installation\n\n  Server:\n\n    $ npm install nodeify\n\n## Usage\n\n### Functional\n\n  Call `nodeify` directly passing the `promise` and an optional `callback` as arguments.  If a `callback` is provided it will be called as `callback(error, result)`.  If `callback` is not a function, `promise` is returned.\n\n```javascript\nvar nodeify = require('nodeify');\n\nfunction myAsyncMethod(arg, callback) {\n  return nodeify(myPromiseMethod(arg), callback);\n}\n```\n\n### Constructor / Method\n\n  The `nodeify.Promise` constructor returns a promise with a `.nodeify` method which behaves just like the functional version above except that the first argument is implicitly `this`.\n\n```javascript\nvar Promise = require('nodeify').Promise;\n\nfunction myAsyncMethod(arg, callback) {\n  return new Promise(function (resolver) {\n    //do async work\n  })\n  .nodeify(callback);\n}\n```\n\n### Extend\n\n#### Extend(promise)\n\n  Takes a promise and extends it to support the `.nodeify` method.  It will still support the nodeify method after calls to `.then`.\n\n```javascript\nvar Promise = require('promise');\nvar nodeify = require('nodeify');\n\nfunction myAsyncMethod(arg, callback) {\n  return nodeify.extend(myPromiseMethod(arg))\n    .nodeify(callback);\n}\n```\n\n#### Extend(PromiseConstructor)\n\n  Takes a PromiseConstructor and extends it to support the `.nodeify` method.\n\n```javascript\nvar PromiseConstructor = require('promise-constructor-used-by-my-promise-method');\n\nrequire('nodeify').extend(PromiseConstructor);\n\nfunction myAsyncMethod(arg, callback) {\n  return myPromiseMethod(arg).nodeify(callback);\n}\n```\n\n#### Extend()\n\n  Extends the default promise constructor (returned by calling `require('promise')`) and extends it to support `.nodeify`.\n\n```javascript\nrequire('nodeify').extend();\n\nfunction myAsyncMethod(arg, callback) {\n  //assuming myPromiseMethod uses `promise` as its promise library\n  return myPromiseMethod(arg).nodeify(callback);\n}\n```\n\n## Licence\n\n  MIT\n\n![viewcount](https://viewcount.jepso.com/count/then/nodeify.png)\n","publish_time":1362073465596,"_cnpm_publish_time":1362073465596,"dist-tags":{"latest":"1.0.1"}}