bluebird-decorator

1.0.0 • Public • Published

bluebird-decorator NPM version Build status

An ES7 decorator for ensuring that every Promise returned by a function is a Bluebird instance.

Installation

Install the package with NPM:

$ npm install bluebird-decorator

Usage

Example:

import bluebird from "bluebird-decorator";
 
class Dog {
  @bluebird
  bark() { return Promise.resolve("Woof!") }
}
 
let dog = new Dog();
let promise = dog.bark(); // Return value is a Bluebird instance, not a Promise.
promise.then(noise => console.log(noise)); // Print "Woof!".

Also, functions that do not return a Promise instance are ignored.

Package Sidebar

Install

npm i bluebird-decorator

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • lukehorvat