While index strings are always strings, really they are special kinds
of values, and `canonicalNumericIndexString` notably does not return a
string but rather a number or undefined. Since `toLength` needs to be
in `value.js`, and these functions are very similar in function and
applicability, it seems best to keep them in the same place.