0.1.1 • Published 8 years ago

isify v0.1.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Isify

Turn an asynchronous function with an expected last parameter callback function of form (err, result) => {...} into a promise that will throw the non-falsy error if present or send the results forward into then.

npm install --save isify

Example

const fs = require('fs')
const isify = require('isify')

// write "Hello World" to local file fileToWrite.txt
isify(fs.writeFile, './fileToWrite.txt', 'Hello World')
  .then(() => {
    console.log('Wrote file')
  })
  .catch(err => {
    console.log('Failed to write with error:', err)
  })
0.1.1

8 years ago

0.1.0

8 years ago