Yes, yet another promise library, it *is* getting a little old I know.

https://www.npmjs.org/package/promisable
https://github.com/iarna/promisable

How exactly does this stand out from the dozens of other promise 
implementations?

* Errors have to be handled or they'll be thrown, saving you from having to 
debug the phantom promise problem, eg:

obj.thingThatPromises()
    .then(function(v){ … });

If the above is rejected then most (all?) other promise libraries would 
just silently ignore it. With promisables it would throw the error, as you 
didn't pass an error callback or use catch.

* Very small code size compared to other promise implementations (4kb, one 
file) due to taking a mostly functional point of view. OO bits are more 
sugar then implementation. The other reason it remains small is that it 
sticks just to implementing the promise abstraction.  It doesn't implement 
combinators.  I'm of the opinion that combinators should go in separate 
promise-library agnostic libraries.  (Why do you care that it's small? The 
internals require less context to grasp.) 

* Libraries that build on this library can easily offer multiple modes of 
operation to allow users to pick the mode they're most comfortable with. 
 Eg:

library.asyncThing(callback) {
    return Promisable.andMaybeCallback(callback,function(R){
        doAsyncThing(R);
    });
}

// And then a user can:

library.asyncThing(function(e,value) { ... });

library.asyncThing()
       .then(function(value){ ... })
       .catch(function(e){ ... });

library.asyncThing()
    (function(e,value){ ... });

(Because the nodejs Google group apparently hates me, I'm reposting this 
from another account. Hopefully the message will go through this time 
instead of being eaten and shunted to the ether.)

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to