Decorator for Yapa promises
Yapawapa is a decorator of Yapa promises. It makes it easy to add arbitrary functions to the prototype of a Yapa promise constructor. Those functions can then seamlessly be used within a promise chain.
$ npm install yapawapa
var yapawapa = require'yapawapa';
Returns a promise constructor whose prototype has been decorated with
decorations. Functions found in
decorations will be wrapped so that they can be used seamlessly in a promise chain. Getters and setters in
decorations will be wrapped so that they are called on the underlying context of the promise instance.
The promise constructor generated by
decorate. All functions that were added through
decorate will be called in the context of
context. All getters and setters will be read/write-throughs to the matching properties of
var Promise = yapawapadecorateget namereturn thisname;return thisname + ' sync';processnextTick cbnull thisname + ' async'; ;;var promise = Promise name: 'yapawapa' ;assertequalpromisename 'yapawapa';promisesyncMethodasyncMethodvaluesassertequalsyncValue 'yapawapa is sync';assertequalasyncValue 'yapawapa is async';;promisefulfill;
$ cd yapawapa$ npm test
Found a bug? Create an issue on GitHub.
For transparency and insight into the release cycle, releases will be numbered with the follow format:
And constructed with the following guidelines:
- Breaking backwards compatibility bumps the major
- New additions without breaking backwards compatibility bumps the minor
- Bug fixes and misc changes bump the patch
For more information on semantic versioning, please visit http://semver.org/.
Copyright (c) 2013 Jake Harding
Licensed under the MIT License.