diff --git a/CHANGELOG.md b/CHANGELOG.md index e78b7a4e..f9244ca1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -455,6 +455,7 @@ A total of 3 people contributed to this release. Thank you to the following cont
+- [`acb12c7`](https://github.com/stdlib-js/stdlib/commit/acb12c77fd8eca09956f62e052f79ce1a0d9c1d0) - **refactor:** improve type specificity for array provided to callback _(by Athan Reines)_ - [`5b71452`](https://github.com/stdlib-js/stdlib/commit/5b71452bd40811341a2e4eaab018c3cc17c5feac) - **docs:** update related packages sections [(#4135)](https://github.com/stdlib-js/stdlib/pull/4135) _(by stdlib-bot, Athan Reines)_ - [`ac735b1`](https://github.com/stdlib-js/stdlib/commit/ac735b1ee32aa14c3760551c3f9a4acf3843fd76) - **feat:** add `ndarray/for-each` [(#3926)](https://github.com/stdlib-js/stdlib/pull/3926) _(by Muhammad Haris, Athan Reines)_ - [`8684eb4`](https://github.com/stdlib-js/stdlib/commit/8684eb429498a239bff9bdd72f443dd1cd981552) - **docs:** update related packages sections [(#4114)](https://github.com/stdlib-js/stdlib/pull/4114) _(by stdlib-bot, Athan Reines)_ diff --git a/map/docs/types/index.d.ts b/map/docs/types/index.d.ts index 3b32038a..9332bae3 100644 --- a/map/docs/types/index.d.ts +++ b/map/docs/types/index.d.ts @@ -30,7 +30,7 @@ import { Complex64, Complex128, ComplexLike } from '@stdlib/types/complex'; * * @returns output value */ -type Nullary = ( this: V ) => U; +type Nullary = ( this: W ) => V; /** * Callback invoked for each ndarray element. @@ -38,7 +38,7 @@ type Nullary = ( this: V ) => U; * @param value - current array element * @returns output value */ -type Unary = ( this: V, value: T ) => U; +type Unary = ( this: W, value: T ) => V; /** * Callback invoked for each ndarray element. @@ -47,7 +47,7 @@ type Unary = ( this: V, value: T ) => U; * @param indices - current array element indices * @returns output value */ -type Binary = ( this: V, value: T, indices: Array ) => U; +type Binary = ( this: W, value: T, indices: Array ) => V; /** * Callback invoked for each ndarray element. @@ -57,7 +57,7 @@ type Binary = ( this: V, value: T, indices: Array ) => U; * @param arr - input array * @returns output value */ -type Ternary = ( this: V, value: T, indices: Array, arr: typedndarray ) => U; +type Ternary = ( this: W, value: T, indices: Array, arr: U ) => V; /** * Callback invoked for each ndarray element. @@ -67,7 +67,7 @@ type Ternary = ( this: V, value: T, indices: Array, arr: typedn * @param arr - input array * @returns output value */ -type Callback = Nullary | Unary | Binary | Ternary; +type Callback = Nullary | Unary | Binary | Ternary; /** * Interface describing function options. @@ -296,7 +296,7 @@ interface GenericOptions extends Options { * var arr = ndarray2array( y ); * // returns [ [ 20.0, 30.0, 40.0 ], [ 80.0, 90.0, 100.0 ] ] */ -declare function map( x: float64ndarray, fcn: Callback, thisArg?: ThisParameterType> ): float64ndarray; +declare function map( x: float64ndarray, fcn: Callback, thisArg?: ThisParameterType> ): float64ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -329,7 +329,7 @@ declare function map( x: float64ndarray, fcn: Callback( x: float32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): float32ndarray; +declare function map( x: float32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): float32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -358,7 +358,7 @@ declare function map( x: float32ndarray, fcn: Callback */ -declare function map( x: complex64ndarray, fcn: Callback, thisArg?: ThisParameterType> ): complex64ndarray; +declare function map( x: complex64ndarray, fcn: Callback, thisArg?: ThisParameterType> ): complex64ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -387,7 +387,7 @@ declare function map( x: complex64ndarray, fcn: Callback */ -declare function map( x: complex128ndarray, fcn: Callback, thisArg?: ThisParameterType> ): complex128ndarray; +declare function map( x: complex128ndarray, fcn: Callback, thisArg?: ThisParameterType> ): complex128ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -420,7 +420,7 @@ declare function map( x: complex128ndarray, fcn: Callback( x: int32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int32ndarray; +declare function map( x: int32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -453,7 +453,7 @@ declare function map( x: int32ndarray, fcn: Callback( x: int16ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int16ndarray; +declare function map( x: int16ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int16ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -486,7 +486,7 @@ declare function map( x: int16ndarray, fcn: Callback( x: int8ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int8ndarray; +declare function map( x: int8ndarray, fcn: Callback, thisArg?: ThisParameterType> ): int8ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -519,7 +519,7 @@ declare function map( x: int8ndarray, fcn: Callback( x: uint32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint32ndarray; +declare function map( x: uint32ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -552,7 +552,7 @@ declare function map( x: uint32ndarray, fcn: Callback( x: uint16ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint16ndarray; +declare function map( x: uint16ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint16ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -585,7 +585,7 @@ declare function map( x: uint16ndarray, fcn: Callback( x: uint8ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint8ndarray; +declare function map( x: uint8ndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint8ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -618,7 +618,7 @@ declare function map( x: uint8ndarray, fcn: Callback( x: uint8cndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint8cndarray; +declare function map( x: uint8cndarray, fcn: Callback, thisArg?: ThisParameterType> ): uint8cndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -651,7 +651,7 @@ declare function map( x: uint8cndarray, fcn: Callback( x: boolndarray, fcn: Callback, thisArg?: ThisParameterType> ): boolndarray; +declare function map( x: boolndarray, fcn: Callback, thisArg?: ThisParameterType> ): boolndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -683,7 +683,7 @@ declare function map( x: boolndarray, fcn: Callback( x: genericndarray, fcn: Callback, thisArg?: ThisParameterType> ): genericndarray; +declare function map( x: genericndarray, fcn: Callback, V, W>, thisArg?: ThisParameterType, V, W>> ): genericndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -721,7 +721,7 @@ declare function map( x: genericndarray( x: typedndarray, options: Float64Options, fcn: Callback, thisArg?: ThisParameterType> ): float64ndarray; +declare function map( x: typedndarray, options: Float64Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): float64ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -759,7 +759,7 @@ declare function map( x: typedndarray, options: Flo * var arr = ndarray2array( y ); * // returns [ [ 20.0, 30.0, 40.0 ], [ 80.0, 90.0, 100.0 ] ] */ -declare function map( x: typedndarray, options: Float32Options, fcn: Callback, thisArg?: ThisParameterType> ): float32ndarray; +declare function map( x: typedndarray, options: Float32Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): float32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -794,7 +794,7 @@ declare function map( x: typedndarray, options: Flo * var y = map( x, opts, toComplex ); * // returns */ -declare function map( x: typedndarray, options: Complex128Options, fcn: Callback, thisArg?: ThisParameterType> ): complex128ndarray; +declare function map( x: typedndarray, options: Complex128Options, fcn: Callback, ComplexLike, W>, thisArg?: ThisParameterType, ComplexLike, W>> ): complex128ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -829,7 +829,7 @@ declare function map( x: typedndarray, options: Com * var y = map( x, opts, toComplex ); * // returns */ -declare function map( x: typedndarray, options: Complex64Options, fcn: Callback, thisArg?: ThisParameterType> ): complex64ndarray; +declare function map( x: typedndarray, options: Complex64Options, fcn: Callback, ComplexLike, W>, thisArg?: ThisParameterType, ComplexLike, W>> ): complex64ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -867,7 +867,7 @@ declare function map( x: typedndarray, options: Com * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Int32Options, fcn: Callback, thisArg?: ThisParameterType> ): int32ndarray; +declare function map( x: typedndarray, options: Int32Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): int32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -905,7 +905,7 @@ declare function map( x: typedndarray, options: Int * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Int16Options, fcn: Callback, thisArg?: ThisParameterType> ): int16ndarray; +declare function map( x: typedndarray, options: Int16Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): int16ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -943,7 +943,7 @@ declare function map( x: typedndarray, options: Int * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Int8Options, fcn: Callback, thisArg?: ThisParameterType> ): int8ndarray; +declare function map( x: typedndarray, options: Int8Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): int8ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -981,7 +981,7 @@ declare function map( x: typedndarray, options: Int * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Uint32Options, fcn: Callback, thisArg?: ThisParameterType> ): uint32ndarray; +declare function map( x: typedndarray, options: Uint32Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): uint32ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -1019,7 +1019,7 @@ declare function map( x: typedndarray, options: Uin * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Uint16Options, fcn: Callback, thisArg?: ThisParameterType> ): uint16ndarray; +declare function map( x: typedndarray, options: Uint16Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): uint16ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -1057,7 +1057,7 @@ declare function map( x: typedndarray, options: Uin * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Uint8Options, fcn: Callback, thisArg?: ThisParameterType> ): uint8ndarray; +declare function map( x: typedndarray, options: Uint8Options, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): uint8ndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -1095,7 +1095,7 @@ declare function map( x: typedndarray, options: Uin * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: Uint8COptions, fcn: Callback, thisArg?: ThisParameterType> ): uint8cndarray; +declare function map( x: typedndarray, options: Uint8COptions, fcn: Callback, number, W>, thisArg?: ThisParameterType, number, W>> ): uint8cndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -1134,7 +1134,7 @@ declare function map( x: typedndarray, options: Uin * var arr = ndarray2array( y ); * // returns [ [ true, true, true ], [ true, true, true ] ] */ -declare function map( x: typedndarray, options: BoolOptions, fcn: Callback, thisArg?: ThisParameterType> ): boolndarray; +declare function map( x: typedndarray, options: BoolOptions, fcn: Callback, boolean, W>, thisArg?: ThisParameterType, boolean, W>> ): boolndarray; /** * Applies a callback function to elements in an input ndarray and assigns results to elements in a new output ndarray. @@ -1172,7 +1172,7 @@ declare function map( x: typedndarray, options: Boo * var arr = ndarray2array( y ); * // returns [ [ 20, 30, 40 ], [ 80, 90, 100 ] ] */ -declare function map( x: typedndarray, options: GenericOptions, fcn: Callback, thisArg?: ThisParameterType> ): genericndarray; +declare function map( x: typedndarray, options: GenericOptions, fcn: Callback, V, W>, thisArg?: ThisParameterType, V, W>> ): genericndarray; // EXPORTS //