unthenify
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

Un-thenify

NPM version NPM downloads Build status Test coverage

Callbackify a promise function. The logical reverse of thenify.

Installation

npm install unthenify --save

Usage

Wrap a function that usually returns a promise to accept callbacks.

import { unthenify } from 'unthenify'
 
const handler = unthenify(async function (payload) {
  // Do something...
 
  return true
})
 
// Use with callback-style.
handler({}, function (err, result) {
  console.log(err, result) //=> undefined, true
})

License

Apache 2.0

Package Sidebar

Install

npm i unthenify

Weekly Downloads

1

Version

2.0.0

License

Apache-2.0

Last publish

Collaborators

  • blakeembrey