Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update namespace TypeScript declarations #1122

Merged
merged 1 commit into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions lib/node_modules/@stdlib/array/base/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import bbinary2d = require( '@stdlib/array/base/broadcasted-binary2d' );
import bbinary3d = require( '@stdlib/array/base/broadcasted-binary3d' );
import bbinary4d = require( '@stdlib/array/base/broadcasted-binary4d' );
import bbinary5d = require( '@stdlib/array/base/broadcasted-binary5d' );
import bternary2d = require( '@stdlib/array/base/broadcasted-ternary2d' );
import bunary2d = require( '@stdlib/array/base/broadcasted-unary2d' );
import bunary3d = require( '@stdlib/array/base/broadcasted-unary3d' );
import bunary4d = require( '@stdlib/array/base/broadcasted-unary4d' );
Expand Down Expand Up @@ -86,6 +87,7 @@ import ones5d = require( '@stdlib/array/base/ones5d' );
import onesnd = require( '@stdlib/array/base/onesnd' );
import setter = require( '@stdlib/array/base/setter' );
import take = require( '@stdlib/array/base/take' );
import ternary2d = require( '@stdlib/array/base/ternary2d' );
import toAccessorArray = require( '@stdlib/array/base/to-accessor-array' );
import unary2d = require( '@stdlib/array/base/unary2d' );
import unary2dBy = require( '@stdlib/array/base/unary2d-by' );
Expand Down Expand Up @@ -583,6 +585,44 @@ interface Namespace {
*/
bbinary5d: typeof bbinary5d;

/**
* Applies a ternary callback to elements in three broadcasted input arrays and assigns results to elements in a two-dimensional nested output array.
*
* ## Notes
*
* - The input array shapes must be broadcast compatible with the output array shape.
*
* @param arrays - array containing three input nested arrays and one output nested array
* @param shapes - array shapes
* @param fcn - ternary callback
*
* @example
* var ones2d = require( `@stdlib/array/base/ones2d` );
* var zeros2d = require( `@stdlib/array/base/zeros2d` );
*
* function add( x, y, z ) {
* return x + y + z;
* }
*
* var shapes = [
* [ 1, 2 ],
* [ 2, 1 ],
* [ 1, 1 ],
* [ 2, 2 ]
* ];
*
* var x = ones2d( shapes[ 0 ] );
* var y = ones2d( shapes[ 1 ] );
* var z = ones2d( shapes[ 2 ] );
* var out = zeros2d( shapes[ 3 ] );
*
* ns.bternary2d( [ x, y, z, out ], shapes, add );
*
* console.log( out );
* // => [ [ 3.0, 6.0 ], [ 9.0, 12.0 ] ]
*/
bternary2d: typeof bternary2d;

/**
* Applies a unary callback to elements in a broadcasted nested input array and assigns results to elements in a two-dimensional nested output array.
*
Expand Down Expand Up @@ -1627,6 +1667,39 @@ interface Namespace {
*/
take: typeof take;

/**
* Applies a ternary callback to elements in three two-dimensional nested input arrays and assigns results to elements in a two-dimensional nested output array.
*
* ## Notes
*
* - The function assumes that the input and output arrays have the same shape.
*
* @param arrays - array containing three input nested arrays and one output nested array
* @param shape - array shape
* @param fcn - ternary callback
*
* @example
* var ones2d = require( `@stdlib/array/base/ones2d` );
* var zeros2d = require( `@stdlib/array/base/zeros2d` );
*
* function add( x, y, z ) {
* return x + y + z;
* }
*
* var shape = [ 2, 2 ];
*
* var x = ones2d( shape );
* var y = ones2d( shape );
* var z = ones2d( shape );
* var out = zeros2d( shape );
*
* ns.ternary2d( [ x, y, z, out ], shape, add );
*
* console.log( out );
* // => [ [ 3.0, 3.0 ], [ 3.0, 3.0 ] ]
*/
ternary2d: typeof ternary2d;

/**
* Converts an array-like object to a minimal array-like object supporting the accessor protocol.
*
Expand Down
20 changes: 20 additions & 0 deletions lib/node_modules/@stdlib/ndarray/base/assert/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import isDataType = require( '@stdlib/ndarray/base/assert/is-data-type' );
import isFloatingPointDataType = require( '@stdlib/ndarray/base/assert/is-floating-point-data-type' );
import isIndexMode = require( '@stdlib/ndarray/base/assert/is-index-mode' );
import isIntegerDataType = require( '@stdlib/ndarray/base/assert/is-integer-data-type' );
import isMostlySafeDataTypeCast = require( '@stdlib/ndarray/base/assert/is-mostly-safe-data-type-cast' );
import isNumericDataType = require( '@stdlib/ndarray/base/assert/is-numeric-data-type' );
import isOrder = require( '@stdlib/ndarray/base/assert/is-order' );
import isReadOnly = require( '@stdlib/ndarray/base/assert/is-read-only' );
Expand Down Expand Up @@ -131,6 +132,9 @@ interface Namespace {
* bool = ns.isCastingMode( 'safe' );
* // returns true
*
* bool = ns.isCastingMode( 'mostly-safe' );
* // returns true
*
* bool = ns.isCastingMode( 'same-kind' );
* // returns true
*
Expand Down Expand Up @@ -432,6 +436,22 @@ interface Namespace {
*/
isIntegerDataType: typeof isIntegerDataType;

/**
* Returns a boolean indicating if a provided ndarray data type can be safely cast or, for floating-point data types, downcast to another ndarray data type.
*
* @param from - ndarray data type
* @param to - ndarray data type
* @returns boolean indicating if a data type can be cast to another data type
*
* @example
* var bool = ns.isMostlySafeDataTypeCast( 'float32', 'float64' );
* // returns true
*
* bool = ns.isMostlySafeDataTypeCast( 'float64', 'int32' );
* // returns false
*/
isMostlySafeDataTypeCast: typeof isMostlySafeDataTypeCast;

/**
* Tests whether an input value is a supported ndarray numeric data type.
*
Expand Down
Loading
Loading