Options
All
  • Public
  • Public/Protected
  • All
Menu

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

Index

Type aliases

Functions

Type aliases

Array3D

Array3D<T>: ArrayLike<ArrayLike<ArrayLike<T>>>

Three-dimensional input array.

Type parameters

  • T

Binary

Binary<T, U, V>: (this: V, value: T, index: number) => U

Callback invoked for each array element.

param

array element

param

current array element indices

returns

result

Type parameters

  • T

  • U

  • V

Type declaration

    • (this: V, value: T, index: number): U
    • Parameters

      • this: V
      • value: T
      • index: number

      Returns U

Callback

Callback<T, U, V>: Nullary<U, V> | Unary<T, U, V> | Binary<T, U, V> | Ternary<T, U, V>

Callback invoked for each array element.

param

array element

param

current array element indices

param

array

returns

result

Type parameters

  • T

  • U

  • V

Nullary

Nullary<U, V>: (this: V) => U

Callback invoked for each array element.

returns

result

Type parameters

  • U

  • V

Type declaration

    • (this: V): U
    • Parameters

      • this: V

      Returns U

Ternary

Ternary<T, U, V>: (this: V, value: T, index: number, arr: Array3D<T>) => U

Callback invoked for each array element.

param

array element

param

current array element indices

param

array

returns

result

Type parameters

  • T

  • U

  • V

Type declaration

    • (this: V, value: T, index: number, arr: Array3D<T>): U
    • Parameters

      • this: V
      • value: T
      • index: number
      • arr: Array3D<T>

      Returns U

Unary

Unary<T, U, V>: (this: V, value: T) => U

Callback invoked for each array element.

param

array element

returns

result

Type parameters

  • T

  • U

  • V

Type declaration

    • (this: V, value: T): U
    • Parameters

      • this: V
      • value: T

      Returns U

Functions

map3d

  • map3d<T, U, V>(arr: Array3D<T>, fcn: Callback<T, U, V>, thisArg?: ThisParameterType<Callback<T, U, V>>): Array<Array<Array<U>>>
  • Applies a function to each nested element in a three-dimensional nested array and assigns the result to a nested element in a new three-dimensional nested array.

    Notes

    • The applied function is provided the following arguments:

      • value: array element.
      • indices: current array element indices.
      • arr: input array.

    Type parameters

    • T

    • U

    • V

    Parameters

    • arr: Array3D<T>

      three-dimensional nested array

    • fcn: Callback<T, U, V>

      function to apply

    • Optional thisArg: ThisParameterType<Callback<T, U, V>>

      input function context

    Returns Array < Array < Array < U > > >

    three-dimensional nested array

    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 = map3d( arr, naryFunction( abs, 1 ) );
    // returns [ [ [ 1, 2, 3 ] ], [ [ 4, 5, 6 ] ] ]