-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd6e1ff
commit acf2130
Showing
233 changed files
with
6,907 additions
and
1,945 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
[**lfi**](../readme.md) • **Docs** | ||
|
||
*** | ||
|
||
[lfi](../globals.md) / at | ||
|
||
# Function: at() | ||
|
||
Returns an iterable containing the value at the given `index` of `iterable` | ||
or an empty iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because iterables do | ||
not support random access. | ||
|
||
## Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
## Example | ||
|
||
```js | ||
const iterable = [`sloth`, `more sloth`, `even more sloth`] | ||
|
||
console.log( | ||
pipe( | ||
iterable, | ||
at(1), | ||
get, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
## at(index) | ||
|
||
> **at**\<`Index`\>(`index`): \<`Value`\>(`iterable`) => [`Optional`](../type-aliases/Optional.md)\<`Value`\> | ||
Returns an iterable containing the value at the given `index` of `iterable` | ||
or an empty iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because iterables do | ||
not support random access. | ||
|
||
### Type Parameters | ||
|
||
• **Index** *extends* `number` | ||
|
||
### Parameters | ||
|
||
• **index**: `NonNegativeInteger`\<`Index`\> | ||
|
||
### Returns | ||
|
||
`Function` | ||
|
||
#### Type Parameters | ||
|
||
• **Value** | ||
|
||
#### Parameters | ||
|
||
• **iterable**: `Iterable`\<`Value`, `any`, `any`\> | ||
|
||
#### Returns | ||
|
||
[`Optional`](../type-aliases/Optional.md)\<`Value`\> | ||
|
||
### Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
### Example | ||
|
||
```js | ||
const iterable = [`sloth`, `more sloth`, `even more sloth`] | ||
|
||
console.log( | ||
pipe( | ||
iterable, | ||
at(1), | ||
get, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
### Defined in | ||
|
||
[slice.d.ts:706](https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/src/operations/slice.d.ts#L706) | ||
|
||
## at(index, iterable) | ||
|
||
> **at**\<`Index`, `Value`\>(`index`, `iterable`): [`Optional`](../type-aliases/Optional.md)\<`Value`\> | ||
Returns an iterable containing the value at the given `index` of `iterable` | ||
or an empty iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because iterables do | ||
not support random access. | ||
|
||
### Type Parameters | ||
|
||
• **Index** *extends* `number` | ||
|
||
• **Value** | ||
|
||
### Parameters | ||
|
||
• **index**: `NonNegativeInteger`\<`Index`\> | ||
|
||
• **iterable**: `Iterable`\<`Value`, `any`, `any`\> | ||
|
||
### Returns | ||
|
||
[`Optional`](../type-aliases/Optional.md)\<`Value`\> | ||
|
||
### Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
### Example | ||
|
||
```js | ||
const iterable = [`sloth`, `more sloth`, `even more sloth`] | ||
|
||
console.log( | ||
pipe( | ||
iterable, | ||
at(1), | ||
get, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
### Defined in | ||
|
||
[slice.d.ts:709](https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/src/operations/slice.d.ts#L709) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
[**lfi**](../readme.md) • **Docs** | ||
|
||
*** | ||
|
||
[lfi](../globals.md) / atAsync | ||
|
||
# Function: atAsync() | ||
|
||
Returns an async iterable containing the value at the given `index` of | ||
`asyncIterable` or an empty async iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because async | ||
iterables do not support random access. | ||
|
||
## Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
## Example | ||
|
||
```js | ||
const asyncIterable = asAsync([`sloth`, `more sloth`, `even more sloth`]) | ||
|
||
console.log( | ||
await pipe( | ||
asyncIterable, | ||
atAsync(1), | ||
getAsync, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
## atAsync(index) | ||
|
||
> **atAsync**\<`Index`\>(`index`): \<`Value`\>(`asyncIterable`) => [`AsyncOptional`](../type-aliases/AsyncOptional.md)\<`Value`\> | ||
Returns an async iterable containing the value at the given `index` of | ||
`asyncIterable` or an empty async iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because async | ||
iterables do not support random access. | ||
|
||
### Type Parameters | ||
|
||
• **Index** *extends* `number` | ||
|
||
### Parameters | ||
|
||
• **index**: `NonNegativeInteger`\<`Index`\> | ||
|
||
### Returns | ||
|
||
`Function` | ||
|
||
#### Type Parameters | ||
|
||
• **Value** | ||
|
||
#### Parameters | ||
|
||
• **asyncIterable**: `AsyncIterable`\<`Value`, `any`, `any`\> | ||
|
||
#### Returns | ||
|
||
[`AsyncOptional`](../type-aliases/AsyncOptional.md)\<`Value`\> | ||
|
||
### Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
### Example | ||
|
||
```js | ||
const asyncIterable = asAsync([`sloth`, `more sloth`, `even more sloth`]) | ||
|
||
console.log( | ||
await pipe( | ||
asyncIterable, | ||
atAsync(1), | ||
getAsync, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
### Defined in | ||
|
||
[slice.d.ts:739](https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/src/operations/slice.d.ts#L739) | ||
|
||
## atAsync(index, asyncIterable) | ||
|
||
> **atAsync**\<`Index`, `Value`\>(`index`, `asyncIterable`): [`AsyncOptional`](../type-aliases/AsyncOptional.md)\<`Value`\> | ||
Returns an async iterable containing the value at the given `index` of | ||
`asyncIterable` or an empty async iterable if `index` is out of bounds. | ||
|
||
WARNING: This function linearly iterates up to `index` because async | ||
iterables do not support random access. | ||
|
||
### Type Parameters | ||
|
||
• **Index** *extends* `number` | ||
|
||
• **Value** | ||
|
||
### Parameters | ||
|
||
• **index**: `NonNegativeInteger`\<`Index`\> | ||
|
||
• **asyncIterable**: `AsyncIterable`\<`Value`, `any`, `any`\> | ||
|
||
### Returns | ||
|
||
[`AsyncOptional`](../type-aliases/AsyncOptional.md)\<`Value`\> | ||
|
||
### Throws | ||
|
||
if `index` is not a non-negative integer. | ||
|
||
### Example | ||
|
||
```js | ||
const asyncIterable = asAsync([`sloth`, `more sloth`, `even more sloth`]) | ||
|
||
console.log( | ||
await pipe( | ||
asyncIterable, | ||
atAsync(1), | ||
getAsync, | ||
), | ||
) | ||
//=> 'more sloth' | ||
``` | ||
|
||
### Defined in | ||
|
||
[slice.d.ts:742](https://github.com/TomerAberbach/lfi/blob/fd6e1ff9d7b7d249090f89ead6d0a30e26aba2e4/src/operations/slice.d.ts#L742) |
Oops, something went wrong.