Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "utils/map2d/docs/types/index.d"

Index

Functions

Functions

Export assignment map2d

  • Applies a function to each nested element in an array of arrays and assigns the result to a nested element in a new array of arrays.

    Notes

    • The applied function is provided the following arguments:

      • value: array element.
      • i: index of the first dimension.
      • j: index of the second dimension.
      • arr: input array.

    Parameters

    • arr: ArrayLike<ArrayLike<any>>

      array of arrays

    • fcn: Function

      function to apply

    • Optional thisArg: any

      input function context

    Returns Array < Array < any > >

    array of arrays

    Example

    var naryFunction = require( `@stdlib/utils/nary-function` );
    var abs = require( `@stdlib/math/base/special/abs` );
    
    var arr = [
        [ -1, -2, -3 ],
        [ -4, -5, -6 ]
    ];
    
    var out = map2d( arr, naryFunction( abs, 1 ) );
    // returns [ [ 1, 2, 3 ], [ 4, 5, 6 ] ]