# iterator-modifier

> A Linq clone. Attempts to be the best Linq clone. Use the from method on the Itmod class to query an iterable.

Latest version **1.0.8** (published 2024-02-29) · ISC license · 0 weekly downloads

## Install

```sh
npm install iterator-modifier
pnpm add iterator-modifier
yarn add iterator-modifier
bun add iterator-modifier
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2024-02-29 |
| First published | 2023-10-15 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 271.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jesse Russell |
| Maintainers | jesserussell411 |
| Keywords | itmod, data, datascience, iterable, linq, map, filter, reduce, functional, declarative, query, typescript, stream, array, list, iterator, no-dependencies, function |

## Links

- npm: https://www.npmjs.com/package/iterator-modifier
- Repository: https://github.com/JesseRussell411/itmod
- Homepage: https://github.com/JesseRussell411/itmod#readme
- Issues: https://github.com/JesseRussell411/itmod/issues
- npm.io page: https://npm.io/package/iterator-modifier

## Alternatives

- [gamedig](https://npm.io/package/gamedig.md) — 29.3K weekly downloads
- [join-monster](https://npm.io/package/join-monster.md) — 12.8K weekly downloads
- [masked](https://npm.io/package/masked.md) — 5.5K weekly downloads
- [@comunica/actor-query-process-explain-logical](https://npm.io/package/@comunica/actor-query-process-explain-logical.md) — 4.7K weekly downloads
- [@veracity/vui](https://npm.io/package/@veracity/vui.md) — 4.6K weekly downloads

## Recent versions

- 1.0.8 (latest) — 2024-02-29
- 1.0.7 — 2024-02-29
- 1.0.6 — 2024-02-27
- 1.0.5 — 2023-11-08
- 1.0.4 — 2023-11-08
- 1.0.3 — 2023-10-16
- 1.0.2 — 2023-10-15
- 1.0.1 — 2023-10-15
- 1.0.0 — 2023-10-15

## README

# itmod
Stands for Iterator Modifier. Linq for typescript.

Allows the use of array operations like map, filter, or reduce on any Iterable (anything with a [Symbol.Iterator] method) with lazy execution.

To install:

`npm install iterator-modifier`

To use:

```
import Itmod from "iterator-modifier";

/** The mean of 2 and 4 */
const mean = Itmod.from([1, 2, 3])
    .map((n) => n + 1)
    .filter((n) => n % 2 === 0)
    .reduce(
        (t, n) => t + n,
        (total, numCount) => total / numCount
    );
console.log("mean:", mean);
```

## Some nice features.

### Lazy execution, above all else.

### Sorting with default behavior that makes sense.

`Itmod.of(1,10, 2, 20, 7, 90, 3).sort().toArray()` => `[1, 2, 3, 7, 10, 20, 90]`

`[1,10, 2, 20, 7, 90, 3].sort()` => `[1, 10, 2, 20, 3, 7, 90]`

### Converting to and from objects.

`Itmod.fromObject({one: 1, two: 2, three: 3}).append(["four", 4]).toObject()` => `{one: 1, two: 2, three: 3, four: 4}`

### Takes any Iterable (or function that returns an Iterable).
### Writen in modern-style typescript.
### Infinite sequences.
### high level optimizations.
### declarative programming.

# Itmod's methods

### forEach

### map

### flat

### filter

### defined

### notNull

### notNullish

### zip

### reduce

### fold

### concat

### preConcat

### append

### prepend

### reverse

### repeat

### first

### final

### distinct

### union

### intersection

### difference

### take

### takeFinal

### takeEveryNth

### takeWhile

### skip

### skipFinal

### skipEveryNth

### skipWhile

### copyWithin

### indexed

### includes

### some

### none

### every

### nonIteratedCountOrUndefined

### count

### min

### max

### groupBy

### split

### partitionBySize

### groupJoin

### innerGroupJoin

### join

### innerJoin

### toArray

### toSet

### toMap

### indexBy

### toObject

### asArray

### asSet

### asMap

### asObject

### sort

### sortDescending

### shuffle

### collapse

### sequenceEquals

### makeString

# SortedItmod's methods

### thenBy

### thenByDescending

# GroupedItmod's methods

### mapGroups

---
_Source: https://npm.io/package/iterator-modifier · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
