On Jun 11, 2014, at 8:49 AM, André Bargull wrote:

> 
> From [1]:
> ```javascript
> function IsConstructor(o) {
>  try {
>    new (new Proxy(o, {construct: () => ({})}));
>    return true;
>  } catch(e) {
>    return false;
>  }
> }
> ```
> 
> This IsConstructor implementation does not trigger any side-effects and works 
> even when the underlying constructor requires arguments etc.
> 
> 
> 
> [1]
> https://github.com/anba/es6draft/blob/master/src/test/scripts/suite/lib/assert.js#L53-L60

+1.  

I was just about to write and post the equivalent.

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

Reply via email to