Skip to content

Commit 43e1357

Browse files
committed
Add Typescript definitions
1 parent ff8be6a commit 43e1357

File tree

18 files changed

+470
-0
lines changed

18 files changed

+470
-0
lines changed
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Tests if a value is an array of arrays.
23+
*
24+
* @param value - value to test
25+
* @returns boolean indicating whether a value is an array of arrays
26+
*
27+
* @example
28+
* var bool = isArrayArray( [ [], [] ] );
29+
* // returns true
30+
*
31+
* bool = isArrayArray( [ {}, {} ] );
32+
* // returns false
33+
*
34+
* bool = isArrayArray( [] );
35+
* // returns false
36+
*/
37+
declare function isArrayArray( value: any ): boolean;
38+
39+
40+
// EXPORTS //
41+
42+
export = isArrayArray;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isArrayArray = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isArrayArray( {} ); // $ExpectType boolean
27+
isArrayArray( [ [], [] ] ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isArrayArray(); // $ExpectError
33+
isArrayArray( [ [], [] ], 123 ); // $ExpectError
34+
}

lib/node_modules/@stdlib/assert/is-array-array/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Tests if a value is a valid array length.
23+
*
24+
* ## Notes
25+
*
26+
* - A valid length property for an Array instance is any integer value on the interval [0, 2^32-1].
27+
*
28+
* @param value - value to test
29+
* @returns boolean indicating if a value is a valid array length
30+
*
31+
* @example
32+
* var bool = isArrayLength( 3 );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isArrayLength( 3.14 );
37+
* // returns false
38+
*/
39+
declare function isArrayLength( value: any ): boolean;
40+
41+
42+
// EXPORTS //
43+
44+
export = isArrayLength;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isArrayLength = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isArrayLength( 3 ); // $ExpectType boolean
27+
isArrayLength( 3.14 ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isArrayLength(); // $ExpectError
33+
isArrayLength( 9, 123 ); // $ExpectError
34+
}

lib/node_modules/@stdlib/assert/is-array-length/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Tests if a value is an array-like object.
23+
*
24+
* ## Notes
25+
*
26+
* - If provided a string, the function returns `false`.
27+
*
28+
* @param value - value to test
29+
* @returns boolean indicating if a value is an array-like object
30+
*
31+
* @example
32+
* var bool = isArrayLikeObject( [] );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isArrayLikeObject( { 'length':10 } );
37+
* // returns true
38+
*
39+
* @example
40+
* var bool = isArrayLikeObject( 'beep' );
41+
* // returns false
42+
*/
43+
declare function isArrayLike( value: any ): boolean;
44+
45+
46+
// EXPORTS //
47+
48+
export = isArrayLike;
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
import isArrayLikeObject = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isArrayLikeObject( [] ); // $ExpectType boolean
27+
isArrayLikeObject( 'beep' ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isArrayLikeObject(); // $ExpectError
33+
isArrayLikeObject( [], 123 ); // $ExpectError
34+
}

lib/node_modules/@stdlib/assert/is-array-like-object/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
"lib": "./lib",
2222
"test": "./test"
2323
},
24+
"types": "./docs/types",
2425
"scripts": {},
2526
"homepage": "https://github.com/stdlib-js/stdlib",
2627
"repository": {
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2019 The Stdlib Authors.
5+
*
6+
* Licensed under the Apache License, Version 2.0 (the "License");
7+
* you may not use this file except in compliance with the License.
8+
* You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Tests if a value is array-like.
23+
*
24+
* ## Notes
25+
*
26+
* - If provided a string, the function returns `true`.
27+
*
28+
* @param value - value to test
29+
* @returns boolean indicating if a value is array-like
30+
*
31+
* @example
32+
* var bool = isArrayLike( [] );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isArrayLike( {'length':10} );
37+
* // returns true
38+
*/
39+
declare function isArrayLike( value: any ): boolean;
40+
41+
42+
// EXPORTS //
43+
44+
export = isArrayLike;

0 commit comments

Comments
 (0)