Skip to content
This repository has been archived by the owner on Dec 12, 2023. It is now read-only.

Enables iteration of objects and numbers in for..of loops, and enhances array iteration.

Notifications You must be signed in to change notification settings

DanielHerr/Better-Iteration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Loop

Enables iteration of objects, functions, and numbers in for..of loops, and enhances array and string iteration. Otherwise the default [Symbol.iterator] will be used. Iteration method can be specified as second argument. Iteration of inherited properties can be disabled using false as the third argument.

Usage:

for(let [ key, value, original ] of loop({ done: false, testing: true }, "object")) {
 console.log(key, value, original)
}
for(let [ value, index, original ] of loop([ "done", "testing" ], "array")) {
 console.log(value, index, original)
}
for(let [ letter, index, original ] of loop("testing", "string")) {
 console.log(letter, index, original)
}
for(let [ number, original ] of loop(4, "number")) {
 console.log(number, original)
}

About

Enables iteration of objects and numbers in for..of loops, and enhances array iteration.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published