1.1.1 • Published 3 years ago

lazy-from v1.1.1

Weekly downloads
8
License
MIT
Repository
github
Last release
3 years ago

lazy-from (Lazy.from)

Tired of .filter().map() allocating two whole arrays every time you chain them? Tired of needing to convert all your iterables to an Array (with Array.from or spread syntax) just to use map, filter, concat, flat, includes, etc?

Use Lazy.from. It's just like Array.from but no conversion to arrays and more features (zip, toSet, take, etc).

Lazy.from([1,2,3])
    .map(x => x*3)
    .filter(x => x%2==0)
    .map(x => `${x}`)
    .concat([10, 11])
    .concat({ *[Symbol.iterator]() { yield 2; yield* "hello"; }})
  • no dependencies (I might add an optional dependency of some typescript type helpers)
  • written in TypeScript with well-cared-for types. Might add a version that doesn't require typescript@^4.0
  • feel free to contribute fixes and new useful methods
  • written using anonymous generator objects in JavaScript which make the codebase tiny and neat, check them out
1.1.1

3 years ago

1.1.0

3 years ago

1.0.1

3 years ago

1.0.0

4 years ago

0.2.0

4 years ago

0.1.0

4 years ago