Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 2.15 KB

number-stream.md

File metadata and controls

88 lines (57 loc) · 2.15 KB

💛 Number Stream

The NumberStream is a Stream that provides number-related methods.

add()

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]

multiply()

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]

subtract()

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]

divide()

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]

mode()

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]