0.3.4 • Published 12 months ago

@freik/iter v0.3.4

Weekly downloads
-
License
Unlicense
Repository
github
Last release
12 months ago

Iter

A library to make Javascript Iterators and Iterables reasonably useful

The idea is that I want to be able to do things like this:

const collection = new Set([1, 2, 3, 4]);
Iter(collection)
  .map((f) => f * 2)
  .forEach(console.log);

and that should print out

1
4
9
16

Why is this what I want? Because LINQ was awesome (and C# is a truly excellent language) and the fact that you don't actually have to first create an array before you start doing useful things to the iterable is a very good thing.

Here's perhaps a more useful example:

const aFilteredCollection = Iter.Range(0, 500000)
  .filter((f) => f.value < 3)
  .map((f) => ({ value: f, name: 'Less than 3' }));

// I still haven't done anything with that collection
// It's an Iter, which can be iterated over
console.log(aFilteredCollection);

// And this will create an array
const values = [...aFilteredCollection];

// This will walk the collection:
aFilteredCollection.forEach(console.log);

All this looks interesting, but I haven't done anything yet, just jotting down ideas, because the linq.js thing I found looked pretty terrible...

0.1.20

12 months ago

0.1.21

12 months ago

0.1.22

12 months ago

0.1.24

12 months ago

0.1.25

12 months ago

0.2.1

12 months ago

0.2.0

12 months ago

0.1.16

1 year ago

0.1.17

1 year ago

0.1.18

1 year ago

0.1.19

12 months ago

0.3.2

12 months ago

0.3.1

12 months ago

0.3.4

12 months ago

0.3.3

12 months ago

0.1.12

2 years ago

0.1.13

2 years ago

0.1.15

2 years ago

0.1.11

2 years ago

0.1.10

2 years ago

0.1.8

3 years ago

0.1.7

3 years ago

0.1.4

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago