callsync

1.0.0 • Public • Published

Callsync

Overview

Being built on top of deasync, this simple utility is to simplify the process of de-async callback functions.

Install

$ npm install --save callsync

Usage

const callsync = require('callsync')
 
// Download a resource
// @param url: (String) A valid url
// @param callback: (Function) a function (err, result) to process result
function download(url, callback){
    console.log('Downloading url = ' + url + '...')
    var content = 'hi hi hi' // just fake it
    callback(null, content)
}
 
var res = callsync( download, null, ['https://github.com/anhldbk/callsync'] )
// err = res[0], result = res[1]

For more usecases, have a look at ./test.js

License

The MIT License (MIT)

Readme

Keywords

Package Sidebar

Install

npm i callsync

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • anhldbk