node package manager


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 context.

var Promise = yapawapa.decorate({
  get name() {
, syncMethod: function() { 
    return + ' sync'; 
, asyncMethod: function(cb) { 
    process.nextTick( function() { cb(null, + ' async'); });
var promise = Promise({ name: 'yapawapa' });
assert.equal(, 'yapawapa');
.values(function(syncValue, asyncValue) {
  assert.equal(syncValue, 'yapawapa is sync');
  assert.equal(asyncValue, 'yapawapa is async');
$ 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

Copyright (c) 2013 Jake Harding
Licensed under the MIT License.