Jason Orendorff (2014-12-19T17:22:55.000Z)
On Tue, Dec 16, 2014 at 3:05 PM, Tom Schuster <tom at schuster.me> 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
d at domenic.me (2015-01-05T20:42:27.973Z)
On Tue, Dec 16, 2014 at 3:05 PM, Tom Schuster <tom at schuster.me> wrote:
> right now there is no way in normal JS code to replicate the IsConstructor
> check defined in 7.2.4.

```js
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.