promisify.js
function promisify_func(result_transformer) {
    result_transformer = result_transformer || identity;

    var transformer = function (func_promise) {
        return function (/* ... */) {
            var args = arguments;
            return result_transformer(when(func_promise, function (func) {
                return func.apply(null, args);
            }));
        };
    };

    transformer.for_property = function (obj_promise, prop) {
        return function (/* ... */) {
            var args = arguments;
            return result_transformer(when(obj_promise, function (obj) {
                return obj[prop].apply(obj, args);
            }));
        };
    };

    return transformer;
}
function promisify_func(result_transformer) {
    result_transformer = result_transformer || identity;

    var transformer = function (func_promise) {
        return function (/* ... */) {
            var args = arguments;
            return result_transformer(when(func_promise, function (func) {
                return func.apply(null, args);
            }));
        };
    };

    transformer.for_property = function (obj_promise, prop) {
        return function (/* ... */) {
            var args = arguments;
            return result_transformer(when(obj_promise, function (obj) {
                return obj[prop].apply(obj, args);
            }));
        };
    };

    return transformer;
}
function promisify_func ( result_transformer ) { result_transformer = result_transformer || identity ; var transformer = function ( func_promise ) { return function ( /* ... */ ) { var args = arguments ; return result_transformer ( when ( func_promise , function ( func ) { return func . apply ( null , args ) ; } ) ) ; } ; } ; transformer . for_property = function ( obj_promise , prop ) { return function ( /* ... */ ) { var args = arguments ; return result_transformer ( when ( obj_promise , function ( obj ) { return obj [ prop ] . apply ( obj , args ) ; } ) ) ; } ; } ; return transformer ; }
Produces a transformer that takes a promised function, and returns a function returning a promise, optionally transforming that promise.
Produces a transformer that takes a promised function and returns a function returning a promise optionally transforming that promise .