fluentfixture
ContributionCode of Conduct
  • Fluent Fixture
  • PACKAGES
    • @fluentfixture/core
      • Everything Is A Factory
      • Streams
        • Stream
        • Boolean Stream
        • Number Stream
        • String Stream
        • Date Stream
        • Array Stream
        • Object Stream
      • Generators
      • Live Demo
    • @fluentfixture/format
      • Structure
      • Pipe Functions
        • Built-In Pipes
        • Custom Pipes
      • How To Use
      • Error Handling
      • Live Demo
  • 🫂Contribution
  • 🐦Follow me on Twitter :)
Powered by GitBook
On this page
  • add()
  • multiply()
  • subtract()
  • divide()
  • mode()
Edit on GitHub
  1. PACKAGES
  2. @fluentfixture/core
  3. Streams

Number Stream

PreviousBoolean StreamNextString Stream

Last updated 7 months ago

The NumberStream is a that provides number-related methods.

add()

Returns a 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 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()

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()

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()

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]

Returns a that subtracts the given value from the produced output.

Returns a that divides the produced output to the given value.

Returns a that calculates the mode of the produced value with the given value.

Stream
NumberStream
NumberStream
NumberStream
NumberStream
NumberStream