Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "math/iter/tools/map3/docs/types/index.d"

Index

Interfaces

Type aliases

Functions

Type aliases

Iterator

Iterator: Iter | IterableIterator

Ternary

Ternary: (x: number, y: number, z: number) => any

Function which transforms iterated numeric values.

param

iterated value from first input iterator

param

iterated value from second input iterator

param

iterated value from third input iterator

returns

result

Type declaration

    • (x: number, y: number, z: number): any
    • Parameters

      • x: number
      • y: number
      • z: number

      Returns any

Functions

Export assignment iterMap3

  • Returns an iterator which invokes a ternary function accepting numeric arguments for each iterated value.

    Notes

    • When invoked, the input function is provided three arguments:

      • x: iterated value from first input iterator
      • y: iterated value from second input iterator
      • z: iterated value from third input iterator
    • If provided a numeric value as an iterator argument, the value is broadcast as an infinite iterator which always returns the provided value.

    • If an iterated value is non-numeric (including NaN), the returned iterator returns NaN. If non-numeric iterated values are possible, you are advised to provide an iterator which type checks and handles non-numeric values accordingly.

    • The length of the returned iterator is equal to the length of the shortest provided iterator. In other words, the returned iterator ends once one of the provided iterators ends.

    • If an environment supports Symbol.iterator and all provided iterators are iterable, the returned iterator is iterable.

    throws

    must provide valid options

    Parameters

    • iter0: Iterator | number

      first iterator

    • iter1: Iterator | number

      third iterator

    • iter2: Iterator | number
    • fcn: Ternary

      function which transforms iterated values

    • Optional options: Options

      options

    Returns Iterator

    iterator

    Example

    var uniform = require( `@stdlib/random/iter/uniform` );
    var clamp = require( `@stdlib/math/base/special/clamp` );
    
    var x = uniform( 0.0, 10.0 );
    var min = uniform( 0.0, 1.0 );
    var max = uniform( 9.0, 10.0 );
    
    var iter = iterMap3( x, min, max, clamp );
    
    var r = iter.next().value;
    // returns <number>
    
    r = iter.next().value;
    // returns <number>
    
    r = iter.next().value;
    // returns <number>
    
    // ...