On Tue, Dec 16, 2014 at 3:05 PM, Tom Schuster <[email protected]> wrote:
> Hello,
>
> right now there is no way in normal JS code to replicate the IsConstructor
> check defined in 7.2.4.

function isConstructor(obj) {
    var p = new Proxy(obj, {construct() { return p; }});
    try {
        new p;
    } catch (exc) {
        return false;
    }
    return true;
}

This works by exposing the code in 9.5.15 ProxyCreate that's more or
less equivalent to IsConstructor.

-j
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to