{"_id":"with-callback","_rev":"252114","name":"with-callback","description":"A small helper function to bridge the gap when returning a promise from a function that takes a callback","dist-tags":{"latest":"1.0.2"},"maintainers":[{"name":"dbrockman","email":"david.bs@gmail.com"}],"time":{"modified":"2021-06-03T16:15:25.000Z","created":"2016-04-26T11:59:22.959Z","1.0.2":"2016-11-01T09:07:00.740Z","1.0.1":"2016-04-26T13:27:56.848Z","1.0.0":"2016-04-26T11:59:22.959Z"},"users":{},"author":{"name":"David Brockman Smoliansky"},"repository":{"type":"git","url":"git+https://github.com/dbrockman/with-callback.git"},"versions":{"1.0.2":{"name":"with-callback","description":"A small helper function to bridge the gap when returning a promise from a function that takes a callback","main":"index.js","files":["index.js"],"scripts":{"test":"jest","test-cov":"nyc ava --reporter=text --reporter=html","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"devDependencies":{"jest":"^16.0.2","semantic-release":"^4.3.5"},"engines":{"node":">=4"},"jest":{"testEnvironment":"node"},"repository":{"type":"git","url":"git+https://github.com/dbrockman/with-callback.git"},"author":{"name":"David Brockman Smoliansky"},"license":"MIT","bugs":{"url":"https://github.com/dbrockman/with-callback/issues"},"homepage":"https://github.com/dbrockman/with-callback#readme","version":"1.0.2","gitHead":"46a29491a2090a0d65fcd26b639acf1e7f03619e","_id":"with-callback@1.0.2","_shasum":"a09629b9a920028d721404fb435bdcff5c91bc21","_from":".","_npmVersion":"2.15.9","_nodeVersion":"4.6.1","_npmUser":{"name":"dbrockman","email":"david.bs@gmail.com"},"dist":{"shasum":"a09629b9a920028d721404fb435bdcff5c91bc21","size":1906,"noattachment":false,"key":"/with-callback/-/with-callback-1.0.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/with-callback/download/with-callback-1.0.2.tgz"},"maintainers":[{"name":"dbrockman","email":"david.bs@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/with-callback-1.0.2.tgz_1477991218973_0.48267313628457487"},"directories":{},"publish_time":1477991220740,"_cnpm_publish_time":1477991220740,"_hasShrinkwrap":false},"1.0.1":{"name":"with-callback","description":"A small helper function to bridge the gap when returning a promise from a function that takes a callback","main":"index.js","scripts":{"test":"ava","test-cov":"nyc ava --reporter=text --reporter=html","semantic-release":"semantic-release pre && npm publish && semantic-release post"},"devDependencies":{"ava":"^0.14.0","nyc":"^6.4.0","semantic-release":"^4.3.5"},"engines":{"node":">=4"},"repository":{"type":"git","url":"git+https://github.com/dbrockman/with-callback.git"},"author":{"name":"David Brockman Smoliansky"},"license":"MIT","bugs":{"url":"https://github.com/dbrockman/with-callback/issues"},"homepage":"https://github.com/dbrockman/with-callback#readme","version":"1.0.1","gitHead":"6386d3202ebb431a51e5d915c0fc2b9b576e6439","_id":"with-callback@1.0.1","_shasum":"8bb6c0d62b72401f817cb3e28a2222c60f8cf172","_from":".","_npmVersion":"2.15.4","_nodeVersion":"4.4.3","_npmUser":{"name":"dbrockman","email":"david.bs@gmail.com"},"dist":{"shasum":"8bb6c0d62b72401f817cb3e28a2222c60f8cf172","size":2703,"noattachment":false,"key":"/with-callback/-/with-callback-1.0.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/with-callback/download/with-callback-1.0.1.tgz"},"maintainers":[{"name":"dbrockman","email":"david.bs@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/with-callback-1.0.1.tgz_1461677274920_0.2266157576814294"},"directories":{},"publish_time":1461677276848,"_cnpm_publish_time":1461677276848,"_hasShrinkwrap":false},"1.0.0":{"name":"with-callback","version":"1.0.0","description":"A small helper function to bridge the gap when returning a promise from a function that takes a callback","main":"index.js","scripts":{"test":"ava","test-cov":"nyc ava --reporter=text --reporter=html"},"devDependencies":{"ava":"^0.14.0","nyc":"^6.4.0"},"repository":{"type":"git","url":"git+https://github.com/dbrockman/with-callback.git"},"author":{"name":"David Brockman Smoliansky"},"license":"MIT","bugs":{"url":"https://github.com/dbrockman/with-callback/issues"},"homepage":"https://github.com/dbrockman/with-callback#readme","gitHead":"07b7b5520fff3bae805ba703c212edc4331e5b0d","_id":"with-callback@1.0.0","_shasum":"82ea8a645607c347a5497f18521444827601fd84","_from":".","_npmVersion":"3.8.6","_nodeVersion":"4.4.3","_npmUser":{"name":"dbrockman","email":"david.bs@gmail.com"},"dist":{"shasum":"82ea8a645607c347a5497f18521444827601fd84","size":2415,"noattachment":false,"key":"/with-callback/-/with-callback-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/with-callback/download/with-callback-1.0.0.tgz"},"maintainers":[{"name":"dbrockman","email":"david.bs@gmail.com"}],"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/with-callback-1.0.0.tgz_1461671961097_0.46315817232243717"},"directories":{},"publish_time":1461671962959,"_cnpm_publish_time":1461671962959,"_hasShrinkwrap":false}},"readme":"# with-callback\n\nA small helper function to bridge the gap when returning a promise from a function that takes a callback\n\n\nNote that this module will not introduce any custom Promise implementation.\nIt will use the global `Promise` (requires node >= v4).\n\n\n```js\nimport withCallback from 'with-callback';\n// or const withCallback = require('with-callback');\n\n\n// withCallback returns a promise and invokes the function with a callback\n// used to fulfill the promise\nfunction readFile(name) {\n  return withCallback(callback => fs.readFile(name, callback));\n}\n\n\n// arguments can also be passed as an array\nfunction readFile(name) {\n  return withCallback([name], fs.readFile);\n}\n\n\n// A second function can be passed to withCallback to map all arguments\n// passed to the callback to a single value used to resolve the promise.\nfunction example(callback) {\n  callback(null, 'a', 'b');\n}\nconst promise = withCallback(example, (a, b) => [a, b]);\n// promise resolves with ['a', 'b']\n```\n","_attachments":{},"homepage":"https://github.com/dbrockman/with-callback#readme","bugs":{"url":"https://github.com/dbrockman/with-callback/issues"},"license":"MIT"}