{"_id":"nodeify","_rev":"216954","name":"nodeify","description":"Convert promised code to use node style callbacks","dist-tags":{"latest":"1.0.1"},"maintainers":[{"name":"forbeslindesay","email":""}],"time":{"modified":"2023-03-24T09:13:05.000Z","created":"2013-02-28T17:44:25.596Z","1.0.1":"2017-02-26T16:24:21.770Z","1.0.0":"2013-02-28T17:44:25.596Z"},"users":{},"author":{"name":"ForbesLindesay"},"repository":{"type":"git","url":"git+https://github.com/then/nodeify.git"},"versions":{"1.0.1":{"name":"nodeify","version":"1.0.1","description":"Convert promised code to use node style callbacks","scripts":{"test":"mocha -R spec","prepublish":"npm test"},"repository":{"type":"git","url":"git+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"},"dependencies":{"promise":"~1.3.0","is-promise":"~1.0.0"},"gitHead":"444f8a68890fd08b9b30113784833283c61d277e","bugs":{"url":"https://github.com/then/nodeify/issues"},"homepage":"https://github.com/then/nodeify#readme","_id":"nodeify@1.0.1","_shasum":"64ab69a7bdbaf03ce107b4f0335c87c0b9e91b1d","_from":".","_npmVersion":"3.10.3","_nodeVersion":"6.4.0","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":""}],"dist":{"shasum":"64ab69a7bdbaf03ce107b4f0335c87c0b9e91b1d","size":3046,"noattachment":false,"key":"/nodeify/-/nodeify-1.0.1.tgz","tarball":"http://name.csiicloud.com:7001/nodeify/download/nodeify-1.0.1.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/nodeify-1.0.1.tgz_1488126259719_0.5255854076240212"},"directories":{},"publish_time":1488126261770,"_hasShrinkwrap":false,"_cnpm_publish_time":1488126261770,"_cnpmcore_publish_time":"2021-12-16T15:43:18.526Z"},"1.0.0":{"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"},"readmeFilename":"README.md","_id":"nodeify@1.0.0","dist":{"shasum":"2a106c7bfbd6b8490dd53c130ddbfe2ae639a856","size":2249,"noattachment":false,"key":"/nodeify/-/nodeify-1.0.0.tgz","tarball":"http://name.csiicloud.com:7001/nodeify/download/nodeify-1.0.0.tgz"},"_from":".","_npmVersion":"1.2.10","_npmUser":{"name":"forbeslindesay","email":"forbes@lindesay.co.uk"},"maintainers":[{"name":"forbeslindesay","email":""}],"directories":{},"publish_time":1362073465596,"_hasShrinkwrap":false,"_cnpm_publish_time":1362073465596,"_cnpmcore_publish_time":"2021-12-16T15:43:18.801Z"}},"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","_attachments":{},"homepage":"https://github.com/then/nodeify#readme","bugs":{"url":"https://github.com/then/nodeify/issues"},"license":"MIT"}