Skip to content

Commit 2b00af8

Browse files
authored
Merge pull request #6 from jsr-core/fix-docs
docs: update documentations
2 parents 7b1593b + e66d01e commit 2b00af8

27 files changed

+52
-45
lines changed

README.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![codecov](https://codecov.io/github/jsr-core/iterutil/graph/badge.svg?token=pfbLRGU5AM)](https://codecov.io/github/jsr-core/iterutil)
66

77
Iterator / AsyncIterator utility pack for JavaScript and TypeScript. Each module
8-
is designed to work independently, avoiding internal interdependencies as much
8+
is designed to work independently, avoiding internal inter-dependencies as much
99
as possible.
1010

1111
## Usage
@@ -16,7 +16,7 @@ both synchronous and asynchronous iterables (`Iterable` and `AsyncIterable`).
1616

1717
### chain
1818

19-
Chains multiple iterables or async iterables together.
19+
Chains multiple iterables together.
2020

2121
```ts
2222
import { chain } from "@core/iterutil/chain";
@@ -54,7 +54,7 @@ console.log(await toArray(iter)); // [[1, 2], [3, 4], [5]]
5454

5555
### compact
5656

57-
Removes all nullish values from an iterable.
57+
Removes all nullish (`null` or `undefined`) values from an iterable.
5858

5959
```ts
6060
import { compact } from "@core/iterutil/compact";
@@ -73,7 +73,7 @@ console.log(await toArray(iter)); // [1, 2, 3]
7373

7474
### compress
7575

76-
Compress an iterable by selecting elements using a selector iterable.
76+
Compresses an iterable by selecting elements using a selector iterable.
7777

7878
```ts
7979
import { compress } from "@core/iterutil/compress";
@@ -164,7 +164,7 @@ console.log(await toArray(iter)); // [3, 4, 5]
164164

165165
### enumerate
166166

167-
Enumerate an iterable.
167+
Enumerates an iterable.
168168

169169
```ts
170170
import { enumerate } from "@core/iterutil/enumerate";
@@ -318,7 +318,7 @@ await forEach([1, 2, 3], console.log);
318318

319319
### iter
320320

321-
Convert an iterable to an iterator.
321+
Converts an iterable to an iterator.
322322

323323
```ts
324324
import { iter } from "@core/iterutil/iter";
@@ -431,7 +431,7 @@ console.log(odd); // [1, 3, 5]
431431

432432
### range
433433

434-
Generate a range of numbers.
434+
Generates a range of numbers.
435435

436436
```ts
437437
import { range } from "@core/iterutil/range";
@@ -492,7 +492,7 @@ console.log(await some([1, 3, 5], (value) => value % 2 === 0)); // false
492492

493493
### take
494494

495-
Take the first `limit` items from the iterable.
495+
Takes the first `limit` items from the iterable.
496496

497497
```ts
498498
import { take } from "@core/iterutil/take";
@@ -511,7 +511,7 @@ console.log(await toArray(iter)); // [1, 2]
511511

512512
### takeWhile
513513

514-
Take elements from the iterable while the predicate is true.
514+
Takes elements from the iterable while the predicate is true.
515515

516516
```ts
517517
import { takeWhile } from "@core/iterutil/take-while";

async/chain.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
* console.log(await toArray(iter)); // [1, 2, 3, 4]
1414
* ```
1515
*
16-
* It supports chaining malformed iterables.
17-
*
18-
* @example
16+
* @example With malformed iterables
1917
* ```ts
2018
* import { toArray } from "@core/iterutil/async/to-array";
2119
* import { chain } from "@core/iterutil/async/chain";
@@ -36,6 +34,9 @@ export async function* chain<
3634
}
3735
}
3836

37+
/**
38+
* @inner
39+
*/
3940
export type Chain<T> = T extends readonly [] ? never
4041
: T extends readonly [Iterable<infer U>] ? U
4142
: T extends readonly [AsyncIterable<infer U>] ? U

async/compact.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Removes all nullish values from an iterable.
2+
* Removes all nullish (`null` or `undefined`) values from an iterable.
33
*
44
* @param iterable The iterable to compact.
55
* @returns The compacted iterable.

async/compress.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Compress an iterable by selecting elements using a selector iterable.
2+
* Compresses an iterable by selecting elements using a selector iterable.
33
*
44
* @param iterable The iterable to compress.
55
* @param selectors The selectors to use.

async/drop.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
22
* Drops the first `limit` items from the iterable.
33
*
4-
* It throws an error if `limit` is less than 0.
5-
*
64
* @param iterable The iterable to drop items from.
7-
* @param limit The number of items to drop.
5+
* @param limit The number of items to drop. It must be 0 or positive safe integer.
86
* @returns The iterable with the first `limit` items dropped.
7+
* @throws {DropLimitError} If `limit` is less than 0 or non safe integer.
98
*
109
* @example
1110
* ```ts

async/enumerate.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Enumerate an iterable.
2+
* Enumerates an iterable.
33
*
44
* @param iterable The iterable to enumerate.
55
* @param start The starting index.

async/first.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/**
2-
* Returns the first element of an iterable.
3-
* If the iterable is empty, returns `undefined`.
2+
* Returns the first element of an iterable. If the iterable is empty, returns `undefined`.
43
*
54
* @param iterable The iterable to get the first element from.
65
* @returns The first element of the iterable, or `undefined` if the iterable is empty.

async/for_each.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
* @example
88
* ```ts
99
* import { forEach } from "@core/iterutil/async/for-each";
10+
*
1011
* await forEach([1, 2, 3], console.log);
1112
* // 1
1213
* // 2

async/iter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* Convert an iterable to an iterator.
2+
* Converts an iterable to an iterator.
33
*
44
* @param iterable The iterable to convert.
55
* @returns The iterator.

async/take.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
/**
2-
* Take the first `limit` items from the iterable.
3-
*
4-
* It throws an error if `limit` is less than 0.
2+
* Takes the first `limit` items from the iterable.
53
*
64
* @param iterable The iterable to take items from.
7-
* @param limit The number of items to take.
5+
* @param limit The number of items to take. It must be 0 or positive safe integer.
86
* @returns The iterable with the first `limit` items taken.
7+
* @throws {TakeLimitError} If `limit` is less than 0 or non safe integer.
98
*
109
* @example
1110
* ```ts

0 commit comments

Comments
 (0)