Timothy Quinn (2014-02-08T03:26:37.000Z)
An area of challenge in JavaScript is the ability to detect a JavaScript
objects implemented class name. I have done this in the past with some
success by parsing the objects constructor but I know that this depends on
the Object constructor being named and is not very efficient as it requires
the processing of a large string.

Is it possible to include into the ECMA Specification a method of Object
that returns the constructor function name which can be subsequently be
used as an efficient class name detection mechanism? Maybe
<Object>.getFunctionName().

My current current slow but steady method for detecting classes is as
follows:

function objClassName(o){
    if(o===undefined){return "(undefined)" }
    if(o===null){return "(null)" }
    var a=/function\s+(.+)\s*\(.*\)\s*\{/.exec(o.constructor)
    return (a && a[1] ? a[1] : "(unknown)")
};

Thanks!
Tim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140207/16a68e5f/attachment.html>
domenic at domenicdenicola.com (2014-02-10T22:35:43.971Z)
An area of challenge in JavaScript is the ability to detect a JavaScript
objects implemented class name. I have done this in the past with some
success by parsing the objects constructor but I know that this depends on
the Object constructor being named and is not very efficient as it requires
the processing of a large string.

Is it possible to include into the ECMA Specification a method of Object
that returns the constructor function name which can be subsequently be
used as an efficient class name detection mechanism? Maybe `<Object>.getFunctionName()`.

My current current slow but steady method for detecting classes is as
follows:

```js
function objClassName(o){
    if(o===undefined){return "(undefined)" }
    if(o===null){return "(null)" }
    var a=/function\s+(.+)\s*\(.*\)\s*\{/.exec(o.constructor)
    return (a && a[1] ? a[1] : "(unknown)")
};
```
domenic at domenicdenicola.com (2014-02-10T22:35:33.658Z)
An area of challenge in JavaScript is the ability to detect a JavaScript
objects implemented class name. I have done this in the past with some
success by parsing the objects constructor but I know that this depends on
the Object constructor being named and is not very efficient as it requires
the processing of a large string.

Is it possible to include into the ECMA Specification a method of Object
that returns the constructor function name which can be subsequently be
used as an efficient class name detection mechanism? Maybe
<Object>.getFunctionName().

My current current slow but steady method for detecting classes is as
follows:

```js
function objClassName(o){
    if(o===undefined){return "(undefined)" }
    if(o===null){return "(null)" }
    var a=/function\s+(.+)\s*\(.*\)\s*\{/.exec(o.constructor)
    return (a && a[1] ? a[1] : "(unknown)")
};
```