Creating node library that support both node callbacks and promise with bluebird
问题 I am creating a node module and I want to be able to support both node callback and Promise APIs. The library that I hear the best things about (mainly that is it the fastest) is bluebird. So after reading some docs and looking at some other libraries that are using bluebird, I thought this would be the cleanest way to get a method to support both node callback and Promise APIs: this.isAllowed = function(role, resource, permission, callback) { var isAllowedAsync = bluebird.promisify(isAllowed