Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Also, fun is that `.nodeify(cb)` protects against undefined. So, it's a handy way to make your library support both promises and callbacks.

    module.exports = function (arg, optionalCb) {
        return promiseReturningFn(arg).nodeify(optionalCb);
    };


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: