Any plans for implementing Symbol.iterator support? #16

Closed
opened 2023-05-31 23:24:51 +02:00 by razyalov · 2 comments
razyalov commented 2023-05-31 23:24:51 +02:00 (Migrated from github.com)

WIth modern linters, especially with TypeScript code, (e.g. the unicorn/recommended rules), I've noticed it trying to replace my .forEach loops for a for (const item of orderedMapObject) which breaks my code.
Any reason to not implement support for the Symbol.iterator method so that using for() loops will work smoothly with this library?
If this is accepted, I don't PR-ing a fix for this.

WIth modern linters, especially with TypeScript code, (e.g. the `unicorn/recommended` rules), I've noticed it trying to replace my `.forEach` loops for a `for (const item of orderedMapObject)` which breaks my code. Any reason to not implement support for the `Symbol.iterator` method so that using `for()` loops will work smoothly with this library? If this is accepted, I don't PR-ing a fix for this.
marijnh commented 2023-06-01 08:14:17 +02:00 (Migrated from github.com)

A lint that makes baseless assumptions about objects and breaks code sounds like a pretty bad lint.

I don't think iterating over these is an important enough thing to add another method for it, and I don't want to make the library depend on Symbol at this point.

A lint that makes baseless assumptions about objects and breaks code sounds like a pretty bad lint. I don't think iterating over these is an important enough thing to add _another_ method for it, and I don't want to make the library depend on `Symbol` at this point.
razyalov commented 2023-06-01 08:18:49 +02:00 (Migrated from github.com)

A lint that makes baseless assumptions about objects and breaks code sounds like a pretty bad lint.

I agree ☝️

I don't think iterating over these is an important enough thing to add another method for it, and I don't want to make the library depend on Symbol at this point.

Fair enough. I'll scratch this change.

> A lint that makes baseless assumptions about objects and breaks code sounds like a pretty bad lint. > I agree ☝️ > > > I don't think iterating over these is an important enough thing to add _another_ method for it, and I don't want to make the library depend on `Symbol` at this point. Fair enough. I'll scratch this change.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
marijn/orderedmap#16
No description provided.