Skip to content

Commit 1cefe20

Browse files
committed
Add Typescript documentation for function parameters
1 parent bb6931a commit 1cefe20

2 files changed

Lines changed: 90 additions & 2 deletions

File tree

lib/node_modules/@stdlib/utils/every-by-right/docs/types/index.d.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,50 @@
2222

2323
import { Collection } from '@stdlib/types/object';
2424

25+
/**
26+
* Checks whether an element in a collection passes a test.
27+
*
28+
* @returns boolean indicating whether an element in a collection passes a test
29+
*/
30+
type Nullary = () => boolean;
31+
32+
/**
33+
* Checks whether an element in a collection passes a test.
34+
*
35+
* @param value - collection value
36+
* @returns boolean indicating whether an element in a collection passes a test
37+
*/
38+
type Unary = ( value: any ) => boolean;
39+
40+
/**
41+
* Checks whether an element in a collection passes a test.
42+
*
43+
* @param value - collection value
44+
* @param index - collection index
45+
* @returns boolean indicating whether an element in a collection passes a test
46+
*/
47+
type Binary = ( value: any, index: number ) => boolean;
48+
49+
/**
50+
* Checks whether an element in a collection passes a test.
51+
*
52+
* @param value - collection value
53+
* @param index - collection index
54+
* @param collection - input collection
55+
* @returns boolean indicating whether an element in a collection passes a test
56+
*/
57+
type Tertiary = ( value: any, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length
58+
59+
/**
60+
* Checks whether an element in a collection passes a test.
61+
*
62+
* @param value - collection value
63+
* @param index - collection index
64+
* @param collection - input collection
65+
* @returns boolean indicating whether an element in a collection passes a test
66+
*/
67+
type Predicate = Nullary | Unary | Binary | Tertiary;
68+
2569
/**
2670
* Tests whether all elements in a collection pass a test implemented by a predicate function, iterating from right to left.
2771
*
@@ -52,7 +96,7 @@ import { Collection } from '@stdlib/types/object';
5296
* var bool = everyByRight( arr, isPositive );
5397
* // returns true
5498
*/
55-
declare function everyByRight( collection: Collection, predicate: Function, thisArg?: any ): boolean; // tslint-disable-line max-line-length
99+
declare function everyByRight( collection: Collection, predicate: Predicate, thisArg?: any ): boolean; // tslint-disable-line max-line-length
56100

57101

58102
// EXPORTS //

lib/node_modules/@stdlib/utils/every-by/docs/types/index.d.ts

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,50 @@
2222

2323
import { Collection } from '@stdlib/types/object';
2424

25+
/**
26+
* Checks whether an element in a collection passes a test.
27+
*
28+
* @returns boolean indicating whether an element in a collection passes a test
29+
*/
30+
type Nullary = () => boolean;
31+
32+
/**
33+
* Checks whether an element in a collection passes a test.
34+
*
35+
* @param value - collection value
36+
* @returns boolean indicating whether an element in a collection passes a test
37+
*/
38+
type Unary = ( value: any ) => boolean;
39+
40+
/**
41+
* Checks whether an element in a collection passes a test.
42+
*
43+
* @param value - collection value
44+
* @param index - collection index
45+
* @returns boolean indicating whether an element in a collection passes a test
46+
*/
47+
type Binary = ( value: any, index: number ) => boolean;
48+
49+
/**
50+
* Checks whether an element in a collection passes a test.
51+
*
52+
* @param value - collection value
53+
* @param index - collection index
54+
* @param collection - input collection
55+
* @returns boolean indicating whether an element in a collection passes a test
56+
*/
57+
type Tertiary = ( value: any, index: number, collection: Collection ) => boolean; // tslint-disable-line max-line-length
58+
59+
/**
60+
* Checks whether an element in a collection passes a test.
61+
*
62+
* @param value - collection value
63+
* @param index - collection index
64+
* @param collection - input collection
65+
* @returns boolean indicating whether an element in a collection passes a test
66+
*/
67+
type Predicate = Nullary | Unary | Binary | Tertiary;
68+
2569
/**
2670
* Tests whether all elements in a collection pass a test implemented by a predicate function.
2771
*
@@ -52,7 +96,7 @@ import { Collection } from '@stdlib/types/object';
5296
* var bool = everyBy( arr, isPositive );
5397
* // returns true
5498
*/
55-
declare function everyBy( collection: Collection, predicate: Function, thisArg?: any ): boolean; // tslint-disable-line max-line-length
99+
declare function everyBy( collection: Collection, predicate: Predicate, thisArg?: any ): boolean; // tslint-disable-line max-line-length
56100

57101

58102
// EXPORTS //

0 commit comments

Comments
 (0)