1.0.0 • Published 7 years ago

bluebird-decorator v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

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.