IDL enumeration & String.prototype.normalize

Allen Wirfs-Brock allen at
Tue Aug 6 08:32:53 PDT 2013

 On Aug 6, 2013, at 7:59 AM, Anne van Kesteren wrote:

> In IDL not being part of an enumeration throws TypeError. It seems
> String.prototype.normalize uses RangeError. I've no preference as to
> which is better, but it would be good if they were equal.

The argument to String.prototype.noralization is not an enumeration (not an ES concept) but a string.  If the agument can not be converted to a string value, a TypeError is thrown.  If the string value is not within the range of expected values, a RangeError is thrown.  This is all normal ES conventions.

> Also, throughout the platform we typically lowercase enumeration
> constants, e.g. "arraybuffer". I think it would be good for
> String.prototype.normalize to follow that precedent and use "nfc" etc.

The argument values aren't enumeration constants.  They are string values that are the exact the abbreviations used by the Unicode standard to identify normalization forms. 

> (I was a bit surprised to see Unicode normalization exposed here.
> We've been pretty hesitant elsewhere to introduce dependencies on it,
> but I guess at this level it might be okay.)

see for the rationale.


> -- 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list