Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "iter/filter-map/docs/types/index.d"

Index

Type aliases

Binary

Binary: (value: any, i: number) => any

Callback function which both filters and maps.

param

iterated value

param

iteration index

returns

filter result

Type declaration

    • (value: any, i: number): any
    • Parameters

      • value: any
      • i: number

      Returns any

Callback

Callback: Nullary | Unary | Binary

Callback function which both filters and maps.

param

iterated value

param

iteration index

returns

filter result

Iterator

Iterator: Iter | IterableIterator

Nullary

Nullary: () => any

Callback function which both filters and maps.

returns

filter result

Type declaration

    • (): any
    • Returns any

Unary

Unary: (value: any) => any

Callback function which both filters and maps.

param

iterated value

returns

filter result

Type declaration

    • (value: any): any
    • Parameters

      • value: any

      Returns any

Functions

Export assignment iterFilterMap

  • Returns an iterator which both filters and maps a provided iterator's values.

    Notes

    • When invoked, the callback function is provided two arguments:

      • value: iterated value
      • index: iteration index (zero-based)
    • If the callback returns undefined, the iterator invokes the function for the next value of the provided iterator; otherwise, the iterator returns the callback's return value.

    • If an environment supports Symbol.iterator and a provided iterator is iterable, the returned iterator is iterable.

    Parameters

    • iterator: Iterator

      input iterator

    • fcn: Callback

      callback function which both filters and maps

    • Optional thisArg: any

      execution context

    Returns Iterator

    iterator

    Example

    var array2iterator = require( `@stdlib/array/to-iterator` );
    
    function fcn( v ) {
        if ( v > 2 ) {
            return v * 10;
        }
    }
    
    var src = array2iterator( [ 1, 3, 2, 4 ] );
    var iter = iterFilterMap( src, fcn );
    
    var v = iter.next().value;
    // returns 30
    
    v = iter.next().value;
    // returns 40
    
    var bool = iter.next().done;
    // returns true