Skip to content

Commit

Permalink
update wording again
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelficarra authored Aug 7, 2024
1 parent 58222fb commit 7fd4c19
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion normative-conventions.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ NB: This convention is new as of 2024, and most earlier parts of the language do

## Reject primitives in iterable-taking positions

Any time an iterable or async-iterable value (a value that has a `Symbol.iterator` or `Symbol.asyncIterator` method) is expected, primitives should be treated as if they were not iterable. Usually, this will mean throwing a `TypeError`. Primitive wrapper Objects such as String Objects, however, should be treated like any other Object.
Any time an iterable or async-iterable value (a value that has a `Symbol.iterator` or `Symbol.asyncIterator` method) is expected, primitives should be treated as if they were not iterable. Usually, this will mean throwing a `TypeError`. If the user provides a primitive wrapper Object such as a String Object, however, it should be treated like any other Object.

Although primitive Strings are default iterable (`String.prototype` has a `Symbol.iterator` method which enumerates code points), it is now considered a mistake to iterate a String without specifying whether the String is providing an abstraction over code units, code points, grapheme clusters, or something else.

Expand Down

0 comments on commit 7fd4c19

Please sign in to comment.