Kevin Smith (2013-08-20T03:14:54.000Z)
Implementation:

    function unwrap(value) {
        return Promise.resolve(value).then(v => isPromise(v) ? unwrap(v) :
v);
    }

    Promise.when = value => unwrap(value);

Test:

    var promise = new Promise(r => {
        r.fulfill(new Promise(r => { r.fulfill(1); }));
    });

    promise.then(val => console.log(val.then ? "promise" : "value"));
    Promise.when(promise).then(val => console.log(val.then ? "promise" :
"value"));

    >> promise
    >> value

{ Kevin }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130819/00b55ac4/attachment.html>
domenic at domenicdenicola.com (2013-08-29T19:08:30.042Z)
Implementation:

    function unwrap(value) {
        return Promise.resolve(value).then(v => isPromise(v) ? unwrap(v) : v);
    }

    Promise.when = value => unwrap(value);

Test:

    var promise = new Promise(r => {
        r.fulfill(new Promise(r => { r.fulfill(1); }));
    });

    promise.then(val => console.log(val.then ? "promise" : "value"));
    Promise.when(promise).then(val => console.log(val.then ? "promise" : "value"));

    >> promise
    >> value