{"name":"simple-asyncify","version":"1.0.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+https://github.com/lydell/simple-asyncify.git"},"keywords":["async","asyncify","callback"],"scripts":{"test":"jshint index.js test/ && node test/index.js"},"devDependencies":{"jshint":"^2.8.0","tape":"^4.2.0"},"gitHead":"0f425e9ddaeb6d659641e1feaf7339a7d3865ce2","bugs":{"url":"https://github.com/lydell/simple-asyncify/issues"},"homepage":"https://github.com/lydell/simple-asyncify#readme","_id":"simple-asyncify@1.0.0","_shasum":"33ed52597be420f72bfe4ace1d85b0a9d36eeefd","_from":".","_npmVersion":"2.9.0","_nodeVersion":"1.8.4","_npmUser":{"name":"lydell","email":"simon.lydell@gmail.com"},"dist":{"shasum":"33ed52597be420f72bfe4ace1d85b0a9d36eeefd","tarball":"http://registry-npm.ywwl.com/simple-asyncify/download/simple-asyncify-1.0.0.tgz","integrity":"sha512-EAYiklqpzM1tEYWKLr/TeKumNKC6Pogs6mUlGfdRZk9z6nYwGXUTD8gtZCbSuz9CAUa/pJw+eJWtL3CrmwL1lA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCID6RVI4V/cacXNH1ZMW2T1ZswL9uNH9jk/Ei45SkeMtzAiBv3oF4TxuGm6KDx8Tv9jDdseUKq/4EFK0wuK7l5mOdpA=="}],"size":2657,"noattachment":false,"key":"/simple-asyncify/-/simple-asyncify-1.0.0.tgz"},"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":1440228483730,"_cnpm_publish_time":1440228483730,"dist-tags":{"latest":"1.0.0"}}