Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kaelzhang/node-simple-thenify

Make sure a function is thenable
https://github.com/kaelzhang/node-simple-thenify

javascript nodejs promise thenify

Last synced: 20 days ago
JSON representation

Make sure a function is thenable

Awesome Lists containing this project

README

        

[![Build Status](https://travis-ci.org/kaelzhang/node-simple-thenify.svg?branch=master)](https://travis-ci.org/kaelzhang/node-simple-thenify)

# simple-thenify

Make sure that a function will return a promise (thenable).

If a function does not return a promise, it will `promise.resolve` the return value.

## Install

```sh
$ npm install simple-thenify --save
```

## Usage

```js
const thenify = require('simple-thenify')
const fn = thenify(x => x + 1)

fn(1).then(console.log) // 2
```

## License

MIT