JSPM

async.wrapsync

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 9
  • Score
    100M100P100Q37722F
  • License MIT

Take a sync function and make it async, passing its return value to a callback.

Package Exports

  • async.wrapsync

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (async.wrapsync) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

async.wrapsync

Last version Build Status Dependency status Dev Dependencies Status NPM Status Donate

Take a sync function and make it async, passing its return value to a callback. Based on async#asyncify as module.

Install

npm install async.wrapsync --save

If you want to use in the browser (powered by Browserify):

bower install async.wrapsync --save

and later link in your HTML:

<script src="bower_components/async.wrapsync/dist/async.wrapsync.js"></script>

Usage

var wrapSync = require('async.wrapsync');

var parse = wrapSync(JSON.parse);

parse('{\"foo\":bar}', function(err, result) {
  // data is the result of parsing the text.
  // If there was a parsing error, it would have been caught.
});

API

wrapSync(fn)

Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback

Arguments

  • fn - a sync function.

License

MIT © Kiko Beats