You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If ES5-shim is loaded on Node 8.3 and 8.4, parseInt fails parseInt(ws + '08') === 8 and parseInt(ws + '0x16') === 22 by returning NaN, 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-shim ToString does not check for Symbol (I believe, need to check the source: it is using String) and converts it to a string if a primitive, although Symbol object seems to throw, perhaps this is a change in the draft spec (I didn't see any) or just a Node bug?
require('es5-shim');
parseInt(Symbol('')); // Should throw TypeError but gives NaN
Unicode v8.0.0 for whitespace
ECMAScript 6 required Unicode v5.1.0 Zs symbols to be recognized as whitespace in addition to any Zs symbols in whatever Unicode version the engine implemented.
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.
The text was updated successfully, but these errors were encountered: