Add support for System.iterator for-loop #17

Closed
razyalov wants to merge 4 commits from master into master
razyalov commented 2023-06-01 00:28:18 +02:00 (Migrated from github.com)

Allow using the standard JS for-loop over the content of an ordered map instance.

In addition to the original .forEach syntax of:

myOrderedMap.forEach((key,value) => {
...
});

You can now also use it as:

for( const [key, value] of myOrderedMap) {
...
}

NOTE: the motivation for this fix is that modern eslinter configuration (like the unicorn recommended rules) will auto-replace .forEach() with a for() {} loop. Without this addition to the OrderedMap implementation, the linter will break your code.

Allow using the standard JS for-loop over the content of an ordered map instance. In addition to the original `.forEach` syntax of: ```javascript myOrderedMap.forEach((key,value) => { ... }); ``` You can now also use it as: ```javascript for( const [key, value] of myOrderedMap) { ... } ``` NOTE: the motivation for this fix is that modern `eslinter` configuration (like the `unicorn` recommended rules) will auto-replace `.forEach()` with a `for() {}` loop. Without this addition to the `OrderedMap` implementation, the linter will break your code.
marijnh commented 2023-06-01 08:14:54 +02:00 (Migrated from github.com)

See #16 .

See #16 .

Pull request closed

Sign in to join this conversation.
No reviewers
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!17
No description provided.