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.

ParameterTypeDefaultDescription

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.

ParameterTypeDefaultDescription

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.

ParameterTypeDefaultDescription

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.

ParameterTypeDefaultDescription

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.

ParameterTypeDefaultDescription

value

Number

value

import { num } from '@fluentfixture/core';

const stream = num(10).mode(3);

console.log(stream.many(5));
// [1, 1, 1, 1, 1]

Last updated