> On Dec 13, 2016, at 4:51 PM, Sergey R <chi...@gmail.com> wrote:
>
> I want to propose a new language feature — Reflect.toStringSpec.
> Here is a repo https://github.com/chicoxyzzy/proposal-reflect-tostringspec
> <https://github.com/chicoxyzzy/proposal-reflect-tostringspec>
> Some context:
> https://github.com/airbnb/babel-plugin-dynamic-import-node/pull/2/
> <https://github.com/airbnb/babel-plugin-dynamic-import-node/pull/2/>_______________________________________________
Doesn’t this do exactly what you want:
```js
// JS level equivalent of ES spec ToString abstract operation
https://tc39.github.io/ecma262/#sec-tostring
<https://tc39.github.io/ecma262/#sec-tostring>
function ToString(v) {
if (typeof v === “symbol”) throw TypeError(“Can’t convert a symbol to a
string”);
return String(v); //for non-symbols String(v) primitively returns
ToString(v)
}
```
This seems like something that can reasonably be coded as part of a polyfill
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss