content icon indicating copy to clipboard operation
content copied to clipboard

Correction to Iterator.prototype.flatMap()'s callback return type

Open mb21 opened this issue 1 year ago • 1 comments

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

mb21 avatar May 07 '24 16:05 mb21

Preview URLs

(comment last updated: 2024-05-19 13:32:53)

github-actions[bot] avatar May 07 '24 16:05 github-actions[bot]