content
content copied to clipboard
Correction to Iterator.prototype.flatMap()'s callback return type
Description
Correction to Iterator.prototype.flatMap()'s callback return type, which always needs to be an iterator. E.g this does not work (check in Chrome or using a polyfill):
[1, 2, 3].values().flatMap(num => num === 2 ? [2, 2] : 1).toArray()
Motivation
motivated by https://github.com/tc39/proposal-iterator-helpers/issues/275#issuecomment-2098790245
Preview URLs
(comment last updated: 2024-05-19 13:32:53)