0.0.1 • Published 5 years ago

@zhaoyao91/callmise v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

Callmise

Call a callback style function and return a promise.

Introduction

async/await are awesome. But sometimes we get an old style function and we just want to await it to run without any effort to promisify it. If it is your case, this package may help.

Installation

npm i @zhaoyao91/callmise

Usage

const callmise = require("@zhaoyao91/callmise");
const fs = require("fs");

// direct style
const files = await callmise(fs.readdir, "./file/dir");

// indirect style, in some cases the old function is not in standard format
const files = await callmise(done => fs.readdir("./file/dir", done));

License

MIT