tc39 / proposal-joint-iteration

a TC39 proposal to synchronise the advancement of multiple iterators
https://tc39.es/proposal-joint-iteration
51 stars 2 forks source link

fixes #22: throw a TypeError when padding is not an Object #24

Closed michaelficarra closed 2 months ago

michaelficarra commented 2 months ago

Fixes #22. /cc @bakkot

bakkot commented 2 months ago

Probably the appropriate place to perform this check is immediately after reading it? We generally validate early, when doing validation.

Either this is an API which behaves like most existing APIs in allowing strings as iterables, or is a new API which rejects strings as iterables. If it's allowing them, it should allow them for all of iterables, paddingOption, and the iterators being zipped. If it's rejecting them, it should reject them for all three.

Prior to this PR they were rejected for iterables but allowed for paddingOption and the iterators being zipped. After this PR they are rejected for iterables and paddingOption but still allowed in the iterators being zipped.

michaelficarra commented 2 months ago

I'm not sure whether we want to permit iterables to yield strings. I think I'll open a PR and run it by committee.

bakkot commented 2 months ago

Approved but I still think the appropriate place to perform this check is immediately after reading _paddingOption_.

michaelficarra commented 2 months ago

I can do that.