You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Object.groupBy and Map.groupBy take an iterable, such as an array, as their first argument. This can be any iterable, so they can also accept a string.
conststr="abcd";constgrouped=Object.groupBy(str,(char)=>char<'c' ? "x" : "y");
However, it was discovered that in some implementations, a TypeError was thrown when the first argument was not of object type, so this was not working1.
What do you think about adding test cases to test262 to cover this?
Following up from #4038, I think it might help to have additional coverage for ASCII strings (to help debuggability in case an implementation gets single characters right but surrogate pairs wrong) and grapheme clusters (like 👨👦 being split into 👨, ZWJ, and 👦.)
Object.groupBy
andMap.groupBy
take an iterable, such as an array, as their first argument. This can be any iterable, so they can also accept a string.However, it was discovered that in some implementations, a TypeError was thrown when the first argument was not of object type, so this was not working1.
What do you think about adding test cases to test262 to cover this?
Footnotes
https://bugs.webkit.org/show_bug.cgi?id=271524 ↩
The text was updated successfully, but these errors were encountered: