node-swear

1.0.3 • Public • Published

node-swear

Transform node callback style (nodeback) functions into ES6 promise-return function

var swear=require("node-swear");
var fs=require("fs");
swear(fs.readFile)("test/resources/test.txt")
  .then(o=>log("Ok",o.toString()))
  .catch(e=>log("Error",e));

or a more clean style

var swear=require("node-swear");
var fsReadFile=swear(fs.readFile);
//...
fsReadFile("test/resources/test.txt")
  .then(o=>log("Ok",o.toString()))
  .catch(e=>log("Error",e));

Package Sidebar

Install

npm i node-swear

Weekly Downloads

1

Version

1.0.3

License

MIT

Last publish

Collaborators

  • neu-rah