The NumberStream
is a Stream
that provides number-related methods.
Returns a NumberStream
that adds the given value to the produced output.
Parameter | Type | Default | Description |
---|---|---|---|
value |
Number |
value |
import { num } from '@fluentfixture/core';
const stream = num(10).add(0.5);
console.log(stream.many(5));
// [10.5, 10.5, 10.5, 10.5, 10.5]
Returns a NumberStream
that multiplies the given value with the produced output.
Parameter | Type | Default | Description |
---|---|---|---|
value |
Number |
value |
import { num } from '@fluentfixture/core';
const stream = num(10).multiply(0.5);
console.log(stream.many(5));
// [5, 5, 5, 5, 5]
Returns a NumberStream
that subtracts the given value from the produced output.
Parameter | Type | Default | Description |
---|---|---|---|
value |
Number |
value |
import { num } from '@fluentfixture/core';
const stream = num(10).subtract(0.5);
console.log(stream.many(5));
// [9.5, 9.5, 9.5, 9.5, 9.5]
Returns a NumberStream
that divides the produced output to the given value.
Parameter | Type | Default | Description |
---|---|---|---|
value |
Number |
value |
import { num } from '@fluentfixture/core';
const stream = num(10).divide(0.5);
console.log(stream.many(5));
// [20, 20, 20, 20, 20]
Returns a NumberStream
that calculates the mode of the produced value with the given value.
Parameter | Type | Default | Description |
---|---|---|---|
value |
Number |
value |
import { num } from '@fluentfixture/core';
const stream = num(10).mode(3);
console.log(stream.many(5));
// [1, 1, 1, 1, 1]