Closed Xotic750 closed 6 years ago
After a little more searching
Unicode v8.0.0 for whitespace ECMAScript 6 required Unicode v5.1.0
Zs
symbols to be recognized as whitespace in addition to anyZs
symbols in whatever Unicode version the engine implemented.Per tc39/ecma262#300 this is no longer the case in ES2016. :tada:
The only observable change is that U+180E is no longer considered whitespace.
So this could be the reason for parseInt
being shimmed by ES5-shim, and possible several other methods, and leads also to Symbol
primitive being coerced to a string rather than throwing TypeError
.
If ES5-shim is loaded on Node 8.3 and 8.4,
parseInt
failsparseInt(ws + '08') === 8
andparseInt(ws + '0x16') === 22
by returningNaN
, Node seems not to be trimming the ws correctly (or there is a whiteSpaceChracter change in the draft spec?), so the shim is loaded. The ES5-shimToString
does not check forSymbol
(I believe, need to check the source: it is usingString
) and converts it to a string if a primitive, althoughSymbol
object seems to throw, perhaps this is a change in the draft spec (I didn't see any) or just a Node bug?Draft: String: https://tc39.github.io/ecma262/#sec-string-constructor-string-value parseInt: https://tc39.github.io/ecma262/#sec-parseint-string-radix ToString: https://tc39.github.io/ecma262/#sec-tostring
ES2105: String; http://www.ecma-international.org/ecma-262/6.0/#sec-string-constructor-string-value parseInt: http://www.ecma-international.org/ecma-262/6.0/#sec-parseint-string-radix ToString: http://www.ecma-international.org/ecma-262/6.0/#sec-tostring
Maybe I've missed something, not sure, out of time just now.