From a73fa06e9a034cec7034d208b8c0863be1baf152 Mon Sep 17 00:00:00 2001 From: Michael Ficarra Date: Wed, 17 Jul 2024 12:40:04 -0600 Subject: [PATCH] also async iterables --- normative-conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/normative-conventions.md b/normative-conventions.md index 16b2f47..c7c121f 100644 --- a/normative-conventions.md +++ b/normative-conventions.md @@ -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 value (a value that has a `Symbol.iterator` 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`. Primitive wrapper Objects such as String Objects, however, 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.