Need private packages and team management tools?Check out npm Teams »

a-sync

0.0.0 • Public • Published

a-sync

Make sync functions a?sync

Usage

var as = require('a-sync')
var assert = require('assert')
 
var plus1 = as(function(num){
  if (typeof num !== 'number')
  return num + 1
})
 
// sync way
assert.equal(plus1(1), 2)
assert.throws(function(){
  plus1('a')
})
 
// async way
plus1(1, function(err, res){
  assert.equal(res, 2)
})
plus1('a', function(err, res){
  assert.notEqual(err, null)
})

Install

npm i a-sync

DownloadsWeekly Downloads

29

Version

0.0.0

License

MIT

Last publish

Collaborators

  • avatar