Tests whether a string is a valid export name.
Tests whether a string is a valid export name.
A string is a valid export name if and only if it is a valid ECMAScript
IdentifierName
, which is defined in
Section 11.6 of the ECMAScript 2015 specification.
Currently, this implementation is buggy in some corner cases, as it does
not accept code points with the Unicode properties Other_ID_Start
and
Other_ID_Continue
. For example,
isValidIdentifierName(0x2118.toChar.toString)
will return false
instead of true
.
In theory, it does not really account for code points with the Unicode
properties Pattern_Syntax
and Pattern_White_Space
, which should be
rejected. However, with the current version of Unicode (9.0.0), there
seems to be no such character that would be accepted by this method.