Skip to content

hoodie/iterators.ts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lazy Iterators in Typescript

Javascript iterators suck so...

const it = Iter.fromArray(['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l'])
    .enumerate()
    .map(([k, v]) => [k, v.toUpperCase()])
    .filter(([k, v]) => k % 2 == 0)
    .map(([, v]) => v)


const collected = it.take(3)
    .intoArray(); // -> [ 'A', 'C', 'E']

const collected2 = it
    .intoArray(); // -> ['G', 'I', 'K']

About

🛋️ rustical iterators in typescript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published