Skip to content

Commit 8a9863e

Browse files
feat: improve index.d.ts for nanmax-by
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 065a4b9 commit 8a9863e

1 file changed

Lines changed: 45 additions & 12 deletions

File tree

  • lib/node_modules/@stdlib/stats/base/ndarray/nanmax-by/docs/types

lib/node_modules/@stdlib/stats/base/ndarray/nanmax-by/docs/types/index.d.ts

Lines changed: 45 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,49 @@
2222

2323
import { typedndarray } from '@stdlib/types/ndarray';
2424

25-
type Nullary<U> = ( this: U ) => number | void;
26-
type Unary<T, U> = ( this: U, value: T ) => number | void;
27-
type Binary<T, U> = ( this: U, value: T, index: number ) => number | void;
28-
type Ternary<T, U> = ( this: U, value: T, index: number, array: typedndarray<T> ) => number | void;
25+
/**
26+
* Callback function applied to each element of an ndarray.
27+
*
28+
* @returns result
29+
*/
30+
type Nullary<ThisArg> = ( this: ThisArg ) => number | void;
31+
32+
/**
33+
* Callback function applied to each element of an ndarray.
34+
*
35+
* @param value - current array element
36+
* @returns result
37+
*/
38+
type Unary<T, ThisArg> = ( this: ThisArg, value: T ) => number | void;
2939

30-
type Callback<T, U> =
31-
| Nullary<U>
32-
| Unary<T, U>
33-
| Binary<T, U>
34-
| Ternary<T, U>;
40+
/**
41+
* Callback function applied to each element of an ndarray.
42+
*
43+
* @param value - current array element
44+
* @param index - current array element index
45+
* @returns result
46+
*/
47+
type Binary<T, ThisArg> = ( this: ThisArg, value: T, index: number ) => number | void;
48+
49+
/**
50+
* Callback function applied to each element of an ndarray.
51+
*
52+
* @param value - current array element
53+
* @param index - current array element index
54+
* @param array - input ndarray
55+
* @returns result
56+
*/
57+
type Ternary<T, U, ThisArg> = ( this: ThisArg, value: T, index: number, array: U ) => number | void;
58+
59+
/**
60+
* Callback function applied to each element of an ndarray.
61+
*
62+
* @param value - current array element
63+
* @param index - current array element index
64+
* @param array - input ndarray
65+
* @returns result
66+
*/
67+
type Callback<T, U, ThisArg> = Nullary<ThisArg> | Unary<T, ThisArg> | Binary<T, ThisArg> | Ternary<T, U, ThisArg>;
3568

3669
/**
3770
* Computes the maximum value of a one-dimensional ndarray via a callback function, ignoring `NaN` values.
@@ -54,9 +87,9 @@ type Callback<T, U> =
5487
* var v = nanmaxBy( [ x ], clbk );
5588
* // returns 8.0
5689
*/
57-
type Routine =
58-
<T = unknown, U = unknown>( arrays: [ typedndarray<T> ], clbk: Callback<T, U>, thisArg?: ThisParameterType<Callback<T, U>> ) => number;
90+
declare function nanmaxBy<T = unknown, U extends typedndarray<T> = typedndarray<T>, ThisArg = unknown>( arrays: [ U ], clbk: Callback<T, U, ThisArg>, thisArg?: ThisParameterType<Callback<T, U, ThisArg>> ): number;
91+
5992

60-
declare var nanmaxBy: Routine;
93+
// EXPORTS //
6194

6295
export = nanmaxBy;

0 commit comments

Comments
 (0)