Skip to content

Commit 467995e

Browse files
committed
refactor: use more concise type definitions
1 parent 2d6b2bc commit 467995e

File tree

11 files changed

+302
-24
lines changed

11 files changed

+302
-24
lines changed

lib/node_modules/@stdlib/array/base/broadcasted-binary2d/docs/types/index.d.ts

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,44 @@ import { Shape1D, Shape2D } from '@stdlib/types/ndarray';
3131
*/
3232
type Binary<T, U, V> = ( v1: T, v2: U ) => V;
3333

34+
/**
35+
* Input array.
36+
*/
37+
type InputArray<T> = Array1D<T> | Array2D<T>;
38+
39+
/**
40+
* Input array shape.
41+
*/
42+
type InputArrayShape = Shape1D | Shape2D;
43+
44+
/**
45+
* Output array.
46+
*/
47+
type OutputArray<T> = Array2D<T>;
48+
49+
/**
50+
* Output array shape.
51+
*/
52+
type OutputArrayShape = Shape2D;
53+
54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
OutputArray<V>
61+
];
62+
63+
/**
64+
* Input and output array shapes.
65+
*/
66+
type InOutShapes = [
67+
InputArrayShape,
68+
InputArrayShape,
69+
OutputArrayShape
70+
];
71+
3472
/**
3573
* Applies a binary callback to elements in two broadcasted input arrays and assigns results to elements in a two-dimensional nested output array.
3674
*
@@ -62,7 +100,7 @@ type Binary<T, U, V> = ( v1: T, v2: U ) => V;
62100
* console.log( z );
63101
* // => [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ]
64102
*/
65-
declare function bbinary2d<T = unknown, U = unknown, V = unknown>( arrays: [ Array1D<T> | Array2D<T>, Array1D<U> | Array2D<U>, Array2D<V> ], shapes: [ Shape1D | Shape2D, Shape1D | Shape2D, Shape2D ], fcn: Binary<T, U, V> ): void;
103+
declare function bbinary2d<T = unknown, U = unknown, V = unknown>( arrays: InOutArrays<T, U, V>, shapes: InOutShapes, fcn: Binary<T, U, V> ): void;
66104

67105

68106
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-binary3d/docs/types/index.d.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ type OutputArray<T> = Array3D<T>;
5151
*/
5252
type OutputArrayShape = Shape3D;
5353

54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
OutputArray<V>
61+
];
62+
63+
/**
64+
* Input and output array shapes.
65+
*/
66+
type InOutShapes = [
67+
InputArrayShape,
68+
InputArrayShape,
69+
OutputArrayShape
70+
];
71+
5472
/**
5573
* Applies a binary callback to elements in two broadcasted input arrays and assigns results to elements in a three-dimensional nested output array.
5674
*
@@ -82,7 +100,7 @@ type OutputArrayShape = Shape3D;
82100
* console.log( z );
83101
* // => [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ]
84102
*/
85-
declare function bbinary3d<T = unknown, U = unknown, V = unknown>( arrays: [ InputArray<T>, InputArray<U>, OutputArray<V> ], shapes: [ InputArrayShape, InputArrayShape, OutputArrayShape ], fcn: Binary<T, U, V> ): void;
103+
declare function bbinary3d<T = unknown, U = unknown, V = unknown>( arrays: InOutArrays<T, U, V>, shapes: InOutShapes, fcn: Binary<T, U, V> ): void;
86104

87105

88106
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-binary4d/docs/types/index.d.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ type OutputArray<T> = Array4D<T>;
5151
*/
5252
type OutputArrayShape = Shape4D;
5353

54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
OutputArray<V>
61+
];
62+
63+
/**
64+
* Input and output array shapes.
65+
*/
66+
type InOutShapes = [
67+
InputArrayShape,
68+
InputArrayShape,
69+
OutputArrayShape
70+
];
71+
5472
/**
5573
* Applies a binary callback to elements in two broadcasted input arrays and assigns results to elements in a four-dimensional nested output array.
5674
*
@@ -82,7 +100,7 @@ type OutputArrayShape = Shape4D;
82100
* console.log( z );
83101
* // => [ [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ] ]
84102
*/
85-
declare function bbinary4d<T = unknown, U = unknown, V = unknown>( arrays: [ InputArray<T>, InputArray<U>, OutputArray<V> ], shapes: [ InputArrayShape, InputArrayShape, OutputArrayShape ], fcn: Binary<T, U, V> ): void;
103+
declare function bbinary4d<T = unknown, U = unknown, V = unknown>( arrays: InOutArrays<T, U, V>, shapes: InOutShapes, fcn: Binary<T, U, V> ): void;
86104

87105

88106
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-binary5d/docs/types/index.d.ts

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,24 @@ type OutputArray<T> = Array5D<T>;
5151
*/
5252
type OutputArrayShape = Shape5D;
5353

54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
OutputArray<V>
61+
];
62+
63+
/**
64+
* Input and output array shapes.
65+
*/
66+
type InOutShapes = [
67+
InputArrayShape,
68+
InputArrayShape,
69+
OutputArrayShape
70+
];
71+
5472
/**
5573
* Applies a binary callback to elements in two broadcasted input arrays and assigns results to elements in a five-dimensional nested output array.
5674
*
@@ -82,7 +100,7 @@ type OutputArrayShape = Shape5D;
82100
* console.log( z );
83101
* // => [ [ [ [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ], [ [ 2.0, 2.0 ], [ 2.0, 2.0 ] ] ] ] ]
84102
*/
85-
declare function bbinary5d<T = unknown, U = unknown, V = unknown>( arrays: [ InputArray<T>, InputArray<U>, OutputArray<V> ], shapes: [ InputArrayShape, InputArrayShape, OutputArrayShape ], fcn: Binary<T, U, V> ): void;
103+
declare function bbinary5d<T = unknown, U = unknown, V = unknown>( arrays: InOutArrays<T, U, V>, shapes: InOutShapes, fcn: Binary<T, U, V> ): void;
86104

87105

88106
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-quaternary2d/docs/types/index.d.ts

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,48 @@ import { Shape1D, Shape2D } from '@stdlib/types/ndarray';
3131
*/
3232
type Quaternary<T, U, V, W, X> = ( v1: T, v2: U, v3: V, v4: W ) => X;
3333

34+
/**
35+
* Input array.
36+
*/
37+
type InputArray<T> = Array1D<T> | Array2D<T>;
38+
39+
/**
40+
* Input array shape.
41+
*/
42+
type InputArrayShape = Shape1D | Shape2D;
43+
44+
/**
45+
* Output array.
46+
*/
47+
type OutputArray<T> = Array2D<T>;
48+
49+
/**
50+
* Output array shape.
51+
*/
52+
type OutputArrayShape = Shape2D;
53+
54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V, W, X> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
InputArray<V>,
61+
InputArray<W>,
62+
OutputArray<X>
63+
];
64+
65+
/**
66+
* Input and output array shapes.
67+
*/
68+
type InOutShapes = [
69+
InputArrayShape,
70+
InputArrayShape,
71+
InputArrayShape,
72+
InputArrayShape,
73+
OutputArrayShape
74+
];
75+
3476
/**
3577
* Applies a quaternary callback to elements in four broadcasted input arrays and assigns results to elements in a two-dimensional nested output array.
3678
*
@@ -69,7 +111,7 @@ type Quaternary<T, U, V, W, X> = ( v1: T, v2: U, v3: V, v4: W ) => X;
69111
* console.log( out );
70112
* // => [ [ 4.0, 8.0 ], [ 12.0, 16.0 ] ]
71113
*/
72-
declare function bquaternary2d<T = unknown, U = unknown, V = unknown, W = unknown, X = unknown>( arrays: [ Array1D<T> | Array2D<T>, Array1D<U> | Array2D<U>, Array1D<V> | Array2D<V>, Array1D<W> | Array2D<W>, Array2D<X> ], shapes: [ Shape1D | Shape2D, Shape1D | Shape2D, Shape1D | Shape2D, Shape1D | Shape2D, Shape2D ], fcn: Quaternary<T, U, V, W, X> ): void;
114+
declare function bquaternary2d<T = unknown, U = unknown, V = unknown, W = unknown, X = unknown>( arrays: InOutArrays<T, U, V, W, X>, shapes: InOutShapes, fcn: Quaternary<T, U, V, W, X> ): void;
73115

74116

75117
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-quinary2d/docs/types/index.d.ts

Lines changed: 34 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -32,27 +32,47 @@ import { Shape1D, Shape2D } from '@stdlib/types/ndarray';
3232
type Quinary<T, U, V, W, X, Y> = ( v1: T, v2: U, v3: V, v4: W, v5: X ) => Y;
3333

3434
/**
35-
* List of input and output arrays.
35+
* Input array.
36+
*/
37+
type InputArray<T> = Array1D<T> | Array2D<T>;
38+
39+
/**
40+
* Input array shape.
41+
*/
42+
type InputArrayShape = Shape1D | Shape2D;
43+
44+
/**
45+
* Output array.
46+
*/
47+
type OutputArray<T> = Array2D<T>;
48+
49+
/**
50+
* Output array shape.
51+
*/
52+
type OutputArrayShape = Shape2D;
53+
54+
/**
55+
* Input and output arrays.
3656
*/
3757
type InOutArrays<T, U, V, W, X, Y> = [
38-
Array1D<T> | Array2D<T>,
39-
Array1D<U> | Array2D<U>,
40-
Array1D<V> | Array2D<V>,
41-
Array1D<W> | Array2D<W>,
42-
Array1D<X> | Array2D<X>,
43-
Array2D<Y>
58+
InputArray<T>,
59+
InputArray<U>,
60+
InputArray<V>,
61+
InputArray<W>,
62+
InputArray<X>,
63+
OutputArray<Y>
4464
];
4565

4666
/**
47-
* List of input and output array shapes.
67+
* Input and output array shapes.
4868
*/
4969
type InOutShapes = [
50-
Shape1D | Shape2D,
51-
Shape1D | Shape2D,
52-
Shape1D | Shape2D,
53-
Shape1D | Shape2D,
54-
Shape1D | Shape2D,
55-
Shape2D
70+
InputArrayShape,
71+
InputArrayShape,
72+
InputArrayShape,
73+
InputArrayShape,
74+
InputArrayShape,
75+
OutputArrayShape
5676
];
5777

5878
/**

lib/node_modules/@stdlib/array/base/broadcasted-ternary2d/docs/types/index.d.ts

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,46 @@ import { Shape1D, Shape2D } from '@stdlib/types/ndarray';
3131
*/
3232
type Ternary<T, U, V, W> = ( v1: T, v2: U, v3: V ) => W;
3333

34+
/**
35+
* Input array.
36+
*/
37+
type InputArray<T> = Array1D<T> | Array2D<T>;
38+
39+
/**
40+
* Input array shape.
41+
*/
42+
type InputArrayShape = Shape1D | Shape2D;
43+
44+
/**
45+
* Output array.
46+
*/
47+
type OutputArray<T> = Array2D<T>;
48+
49+
/**
50+
* Output array shape.
51+
*/
52+
type OutputArrayShape = Shape2D;
53+
54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U, V, W> = [
58+
InputArray<T>,
59+
InputArray<U>,
60+
InputArray<V>,
61+
OutputArray<W>
62+
];
63+
64+
/**
65+
* Input and output array shapes.
66+
*/
67+
type InOutShapes = [
68+
InputArrayShape,
69+
InputArrayShape,
70+
InputArrayShape,
71+
OutputArrayShape
72+
];
73+
3474
/**
3575
* Applies a ternary callback to elements in three broadcasted input arrays and assigns results to elements in a two-dimensional nested output array.
3676
*
@@ -67,7 +107,7 @@ type Ternary<T, U, V, W> = ( v1: T, v2: U, v3: V ) => W;
67107
* console.log( out );
68108
* // => [ [ 3.0, 6.0 ], [ 9.0, 12.0 ] ]
69109
*/
70-
declare function bternary2d<T = unknown, U = unknown, V = unknown, W = unknown>( arrays: [ Array1D<T> | Array2D<T>, Array1D<U> | Array2D<U>, Array1D<V> | Array2D<V>, Array2D<W> ], shapes: [ Shape1D | Shape2D, Shape1D | Shape2D, Shape1D | Shape2D, Shape2D ], fcn: Ternary<T, U, V, W> ): void;
110+
declare function bternary2d<T = unknown, U = unknown, V = unknown, W = unknown>( arrays: InOutArrays<T, U, V, W>, shapes: InOutShapes, fcn: Ternary<T, U, V, W> ): void;
71111

72112

73113
// EXPORTS //

lib/node_modules/@stdlib/array/base/broadcasted-unary2d/docs/types/index.d.ts

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,42 @@ import { Shape1D, Shape2D } from '@stdlib/types/ndarray';
3131
*/
3232
type Unary<T, U> = ( value: T ) => U;
3333

34+
/**
35+
* Input array.
36+
*/
37+
type InputArray<T> = Array1D<T> | Array2D<T>;
38+
39+
/**
40+
* Input array shape.
41+
*/
42+
type InputArrayShape = Shape1D | Shape2D;
43+
44+
/**
45+
* Output array.
46+
*/
47+
type OutputArray<T> = Array2D<T>;
48+
49+
/**
50+
* Output array shape.
51+
*/
52+
type OutputArrayShape = Shape2D;
53+
54+
/**
55+
* Input and output arrays.
56+
*/
57+
type InOutArrays<T, U> = [
58+
InputArray<T>,
59+
OutputArray<U>
60+
];
61+
62+
/**
63+
* Input and output array shapes.
64+
*/
65+
type InOutShapes = [
66+
InputArrayShape,
67+
OutputArrayShape
68+
];
69+
3470
/**
3571
* Applies a unary callback to elements in a broadcasted nested input array and assigns results to elements in a two-dimensional nested output array.
3672
*
@@ -63,7 +99,7 @@ type Unary<T, U> = ( value: T ) => U;
6399
* console.log( y );
64100
* // => [ [ 10.0, 10.0 ], [ 10.0, 10.0 ] ]
65101
*/
66-
declare function bunary2d<T = unknown, U = unknown>( arrays: [ Array1D<T> | Array2D<T>, Array2D<U> ], shapes: [ Shape1D | Shape2D, Shape2D ], fcn: Unary<T, U> ): void;
102+
declare function bunary2d<T = unknown, U = unknown>( arrays: InOutArrays<T, U>, shapes: InOutShapes, fcn: Unary<T, U> ): void;
67103

68104

69105
// EXPORTS //

0 commit comments

Comments
 (0)