Class: Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:20
Wrapper around IterableIterator interface
offering a set of helpers to deal with iterations in a simple way
Remarks
Since 0.0.7
Type Parameters
| Type Parameter |
|---|
T |
Implements
IterableIterator<T>
Constructors
Constructor
new Stream<
T>(g):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:46
Create a Stream based on g
Parameters
| Parameter | Type | Description |
|---|---|---|
g | IterableIterator<T> | Underlying data of the Stream |
Returns
Stream<T>
Methods
[iterator]()
[iterator]():
IterableIterator<T>
Defined in: packages/fast-check/src/stream/Stream.ts:58
Returns
IterableIterator<T>
Implementation of
IterableIterator.[iterator]
drop()
drop(
n):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:114
Drop n first elements of the Stream
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
n | number | Number of elements to drop |
Returns
Stream<T>
Remarks
Since 0.0.1
dropWhile()
dropWhile(
f):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:96
Drop elements from the Stream while f(element) === true
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => boolean | Drop condition |
Returns
Stream<T>
Remarks
Since 0.0.1
every()
every(
f):boolean
Defined in: packages/fast-check/src/stream/Stream.ts:180
Check whether all elements of the Stream are successful for f
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => boolean | Condition to check |
Returns
boolean
Remarks
Since 0.0.1
filter()
Call Signature
filter<
U>(f):Stream<U>
Defined in: packages/fast-check/src/stream/Stream.ts:157
Filter elements of the Stream
WARNING: It closes the current stream
Type Parameters
| Type Parameter |
|---|
U |
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => v is U | Elements to keep |
Returns
Stream<U>
Remarks
Since 1.23.0
Call Signature
filter(
f):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:166
Filter elements of the Stream
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => boolean | Elements to keep |
Returns
Stream<T>
Remarks
Since 0.0.1
flatMap()
flatMap<
U>(f):Stream<U>
Defined in: packages/fast-check/src/stream/Stream.ts:83
Flat map all elements of the Stream using f
WARNING: It closes the current stream
Type Parameters
| Type Parameter |
|---|
U |
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => IterableIterator<U> | Mapper function |
Returns
Stream<U>
Remarks
Since 0.0.1
getNthOrLast()
getNthOrLast(
nth):T|null
Defined in: packages/fast-check/src/stream/Stream.ts:228
Take the nth element of the Stream of the last (if it does not exist)
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
nth | number | Position of the element to extract |
Returns
T | null
Remarks
Since 0.0.12
has()
has(
f): [boolean,T|null]
Defined in: packages/fast-check/src/stream/Stream.ts:197
Check whether one of the elements of the Stream is successful for f
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => boolean | Condition to check |
Returns
[boolean, T | null]
Remarks
Since 0.0.1
join()
join(...
others):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:215
Join others Stream to the current Stream
WARNING: It closes the current stream and the other ones (as soon as it iterates over them)
Parameters
| Parameter | Type | Description |
|---|---|---|
...others | IterableIterator<T, any, any>[] | Streams to join to the current Stream |
Returns
Stream<T>
Remarks
Since 0.0.1
map()
map<
U>(f):Stream<U>
Defined in: packages/fast-check/src/stream/Stream.ts:71
Map all elements of the Stream using f
WARNING: It closes the current stream
Type Parameters
| Type Parameter |
|---|
U |
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => U | Mapper function |
Returns
Stream<U>
Remarks
Since 0.0.1
next()
next():
IteratorResult<T>
Defined in: packages/fast-check/src/stream/Stream.ts:55
Returns
IteratorResult<T>
Implementation of
IterableIterator.next
take()
take(
n):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:144
Take n first elements of the Stream
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
n | number | Number of elements to take |
Returns
Stream<T>
Remarks
Since 0.0.1
takeWhile()
takeWhile(
f):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:132
Take elements from the Stream while f(element) === true
WARNING: It closes the current stream
Parameters
| Parameter | Type | Description |
|---|---|---|
f | (v) => boolean | Take condition |
Returns
Stream<T>
Remarks
Since 0.0.1
nil()
staticnil<T>():Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:25
Create an empty stream of T
Type Parameters
| Type Parameter |
|---|
T |
Returns
Stream<T>
Remarks
Since 0.0.1
of()
staticof<T>(...elements):Stream<T>
Defined in: packages/fast-check/src/stream/Stream.ts:35
Create a stream of T from a variable number of elements
Type Parameters
| Type Parameter |
|---|
T |
Parameters
| Parameter | Type | Description |
|---|---|---|
...elements | T[] | Elements used to create the Stream |
Returns
Stream<T>
Remarks
Since 2.12.0