Are there any 'harmonious' ways to get the class name from ES6 class instance? Other than
someClassInstance.constructor.name
Currently I'm counting on Traceur implementation. And it seems that Babel has a polyfill for Function.name
while Traceur doesn't.
To sum it all up: there was no other way in ES6/ES2015/Harmony, and nothing is expected ATM in ES.Next.
It may provide useful patterns for unminified server-side applications but is unwanted in applications meant for browser/desktop/mobile.
Babel uses core-js
to polyfill Function.name
, it should be loaded manually for Traceur and TypeScript applications as appropriate.