{"name":"simple-asyncify","version":"0.1.0","author":{"name":"Simon Lydell"},"license":"MIT","description":"Turns sync functions into Node.js-style async ones.","main":"index.js","repository":{"type":"git","url":"git://github.com/lydell/simple-asyncify"},"keywords":["async","asyncify","callback"],"scripts":{"test":"jshint index.js test/ && node test/index.js"},"devDependencies":{"jshint":"^2.4.4","tape":"^2.5.0"},"bugs":{"url":"https://github.com/lydell/simple-asyncify/issues"},"homepage":"https://github.com/lydell/simple-asyncify","_id":"simple-asyncify@0.1.0","dist":{"shasum":"28f4391dfb7c1dd20e069086706067d4ffa237da","tarball":"http://registry-npm.ywwl.com/simple-asyncify/download/simple-asyncify-0.1.0.tgz","integrity":"sha512-gVxb3+CaT5U3gRssh3eF0huZQRbyM/D3e/Ka0wApw8lxR7CPJ4RY1WQl4oKUYB7d07lQwm6sP9j8xDjbWG0mIQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIFnTO5T0GJ+RKjbCmIUHVWUfzy6OVZFvfo9KPgpN2d66AiBEU4jWTX48pxM7sYO7oUkcDbfnYJNYhvx/RB3XCAqxbA=="}],"size":2305,"noattachment":false,"key":"/simple-asyncify/-/simple-asyncify-0.1.0.tgz"},"_from":".","_npmVersion":"1.4.4","_npmUser":{"name":"lydell","email":"simon.lydell@gmail.com"},"maintainers":[{"name":"lydell","email":"simon.lydell@gmail.com"}],"directories":{},"deprecated":"Useless package","readme":"Overview [![Build Status](https://travis-ci.org/lydell/simple-asyncify.svg?branch=master)](https://travis-ci.org/lydell/simple-asyncify)\n========\n\nTurns sync functions into Node.js-style async ones.\n\nInspired by [node-asyncify].\n\n```js\nvar asyncify = require(\"simple-asyncify\")\n\nfunction addSync(a, b) {\n  if (typeof a !== \"number\" || typeof b !== \"number\") {\n    throw new TypeError(\"add requires two numbers\")\n  }\n  return a + b\n}\n\nvar add = asyncify(addSync)\n\nadd(1, 2, function(error, sum) {\n  console.log(\"The sum is: \" + sum)\n})\n\nadd(1, function(error, sum) {\n  console.log(error.message)\n})\n\nconsole.log(\"Let’s do some math!\")\n\n// Let’s do some math!\n// The sum is: 3\n// add requires two numbers\n```\n\n[node-asyncify]: https://github.com/jden/nodeAsyncify\n\n\nInstallation\n============\n\n`npm install simple-asyncify`\n\n```js\nvar asyncify = require(\"simple-asyncify\")\n```\n\n\nUsage\n=====\n\n### `asyncify(syncFn)` ###\n\nReturns an async function that accepts the same arguments as `syncFn` plus a\ncallback. It runs `syncFn` with the arguments. If `syncFn` throws an error, the\ncallback is invoked with that error. Otherwise the callback is invoked with\n`null` and the return value of `syncFn`.\n\n`setImmediate` is used to make the function async.\n\n\nLicense\n=======\n\n[The X11 (“MIT”) License](LICENSE).\n","publish_time":1393875622516,"_cnpm_publish_time":1393875622516,"dist-tags":{"latest":"1.0.0"}}