promisify.js
function promisify_object(template, object_creator) {
    object_creator = object_creator || new_object;
    var transformer = function (obj_promise) {
        var res = object_creator(obj_promise);
        for (var prop in template) {
            res[prop] = template[prop].for_property(obj_promise, prop);
        }
        return res;
    };

    transformer.for_property = function (parent_promise, prop) {
        return transformer(when(parent_promise, function (obj) {
            return obj[prop];
        }));
    };

    return transformer;
}
function promisify_object(template, object_creator) {
    object_creator = object_creator || new_object;
    var transformer = function (obj_promise) {
        var res = object_creator(obj_promise);
        for (var prop in template) {
            res[prop] = template[prop].for_property(obj_promise, prop);
        }
        return res;
    };

    transformer.for_property = function (parent_promise, prop) {
        return transformer(when(parent_promise, function (obj) {
            return obj[prop];
        }));
    };

    return transformer;
}
function promisify_object ( template , object_creator ) { object_creator = object_creator || new_object ; var transformer = function ( obj_promise ) { var res = object_creator ( obj_promise ) ; for ( var prop in template ) { res [ prop ] = template [ prop ] . for_property ( obj_promise , prop ) ; } return res ; } ; transformer . for_property = function ( parent_promise , prop ) { return transformer ( when ( parent_promise , function ( obj ) { return obj [ prop ] ; } ) ) ; } ; return transformer ; }
Produces a transformer that takes a promised object, and returns an object with the properties transformed according to the template.
Produces a transformer that takes a promised object and returns an object with the properties transformed according to the template .