Miss any of our Open RFC calls?Watch the recordings here! »

lafy

0.1.2 • Public • Published

lafy

GitHub license David

lafy is a ridiculously small module that adds a simpler way to promisify instance methods. It can obviously be used on normal promisifiable methods:

const fs = require('fs');
const lafy = require('lafy');
 
// Don't want to bother promisifying a function ?
let contents = await lafy(cb => fs.readFile("/etc/passwd", cb));
 
// Oh no, this class' methods use callbacks ;(
// The only way to promisify methods would be to bind them to an instance
const userManager = new UserManager(/* ... */);
let users = await lafy(cb => userManager.getUsers(cb));
// Much simpler if you only need to do this once or twice !

Download

npm install lafy

Bugs & Suggestions

If you notice any bug or have a suggestion, please tell me about it in the issues, it will help everyone!

Tests

Tests are created with mocha and asserted with chai.expect and chai-as-promised.

You can run the suite using

npm test

License

lafy is licensed under the very permissive MIT License. You may use it for commercial projects if you comply to the license.

Install

npm i lafy

DownloadsWeekly Downloads

2

Version

0.1.2

License

MIT

Unpacked Size

4.94 kB

Total Files

6

Last publish

Collaborators

  • avatar