src/index.js
function promise(p) {
        var me = this;

        var canHandlePromise =
            this.children.indexOf("completed") >= 0 &&
            this.children.indexOf("failed") >= 0;

        if (!canHandlePromise){
            throw new Error("Publisher must have \"completed\" and \"failed\" child publishers");
        }

        p.then(function(response) {
            return me.completed(response);
        }, function(error) {
            return me.failed(error);
        });
    }
function promise(p) {
        var me = this;

        var canHandlePromise =
            this.children.indexOf("completed") >= 0 &&
            this.children.indexOf("failed") >= 0;

        if (!canHandlePromise){
            throw new Error("Publisher must have \"completed\" and \"failed\" child publishers");
        }

        p.then(function(response) {
            return me.completed(response);
        }, function(error) {
            return me.failed(error);
        });
    }
function promise ( p ) { var me = this ; var canHandlePromise = this . children . indexOf ( "completed" ) >= 0 && this . children . indexOf ( "failed" ) >= 0 ; if ( ! canHandlePromise ) { throw new Error ( "Publisher must have \"completed\" and \"failed\" child publishers" ) ; } p . then ( function ( response ) { return me . completed ( response ) ; } , function ( error ) { return me . failed ( error ) ; } ) ; }
Attach handlers to promise that trigger the completed and failed
child publishers, if available.

@param {Object} p The promise to attach to
Attach handlers to promise that trigger the completed and failed child publishers if available .