Skip to content
This repository has been archived by the owner on Mar 27, 2020. It is now read-only.
/ makethen Public archive

✨ Promisify Node.js-style callbacks with native Promise

License

Notifications You must be signed in to change notification settings

deepsweet/makethen

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

makethen

⚠️ Project has been transferred to NexTools metarepo

npm tests coverage

Strongly typed (up to 3 arguments and 3 result params) promisify for Node.js-style callbacks.

Requirements

  • Node.js >= 8.6.0

Install

$ yarn add makethen

Usage

import { readFile } from 'fs'
import makethen from 'makethen'

makethen(readFile)('foo.txt', 'utf8')
  .then((data) => {
    // …
  })
  .catch((error) => {
    // …
  })
import request from 'request'
import makethen from 'makethen'

makethen(request)('https://www.youtube.com/watch?v=dQw4w9WgXcQ')
  .then(([ response, body ]) => {
    // …
  })
  .catch((error) => {
    // …
  })