Skip to content

Make it possible to iterate over arguments in a for/of if it's passed to another function #1303

@MatrixFrog

Description

@MatrixFrog

As documented at https://github.com/google/closure-compiler/wiki/Lint-warning-about-%60arguments%60 we can't transpile the "arguments" object correctly if you iterate over it in a for/of loop, after passing it off to another function. This is because we weren't sure of a good way to identify that it is an Arguments object at runtime. @concavelenz pointed out that we can use Object.prototype.toString.call( item ) === '[object Arguments]'; which feels slightly hacky to me, but will work pretty much everywhere (I think -- we should double check). We can skip adding that check, if the lint warning mentioned in that wiki page never fires.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions