Ambi

ambi

Execute a function ambidextrously.

ambi normalizes the differences between synchronous and asynchronous functions! That is treating synchronous functions as asynchronous functions.

Get it: $ npm install --save ambi

Sample usage:

1
2
3
4
5
6
var ambi = require('ambi');
var child_process = require('child_process');

ambi(child_process.execSync, 'pwd', {encoding: 'utf-8'}, (err, res) => console.log(res)); // Async 

ambi(child_process.exec, 'pwd', {encoding: 'utf-8'}, (err, res) => console.log(res)); // Sync

GIF FTW!

ambi

Thanks to Benjamin Lupton for this module.

Suggest a module

Comments