fp

function-promisify

Turns synchronous functions into promise-based

Showing:

Popularity

Downloads/wk

3

GitHub Stars

1

Maintenance

Last Commit

6yrs ago

Contributors

1

Package

Dependencies

1

Size (min+gzip)

0.8KB

License

Apache-2.0

Type Definitions

Tree-Shakeable

No?

Categories

Readme

function-promisify

Turns synchronous functions into promise-based

Features

  • Allows to write promise-based code in syncronous manner
  • Supports any function arity

Installation

npm install function-promisify

Usage

var promisify = require('function-promisify');

var multiply = promisify(function (number, multiplier) {
    return number * multiplier;
});

var log = promisify(console.log);

// Here we can treat existing and future values in exactly the same manner
log(multiply(100, 3));
log(multiply(Promise.resolve(200), 4));
log(multiply(300, Promise.resolve(10)));
log(multiply(Promise.resolve(400), Promise.resolve(5)));

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100