Skip to content

Commit e7acbfd

Browse files
committed
Add Typescript definitions
1 parent 960678a commit e7acbfd

File tree

12 files changed

+382
-0
lines changed

12 files changed

+382
-0
lines changed
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 finite double-precision floating-point number is a negative integer.
23+
*
24+
* ## Notes
25+
*
26+
* - The function assumes a finite number. If provided negative infinity, the function will return `true`, when, in fact, the result is undefined.
27+
*
28+
* @param x - value to test
29+
* @returns boolean indicating whether the value is a negative integer
30+
*
31+
* @example
32+
* var bool = isNegativeInteger( -1.0 );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isNegativeInteger( 0.0 );
37+
* // returns false
38+
*
39+
* @example
40+
* var bool = isNegativeInteger( 10.0 );
41+
* // returns false
42+
*/
43+
declare function isNegativeInteger( x: number ): boolean;
44+
45+
46+
// EXPORTS //
47+
48+
export = isNegativeInteger;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 isNegativeInteger = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isNegativeInteger( 2 ); // $ExpectType boolean
27+
isNegativeInteger( 3.12 ); // $ExpectType boolean
28+
isNegativeInteger( -2 ); // $ExpectType boolean
29+
}
30+
31+
// The function does not compile if provided a value other than a number...
32+
{
33+
isNegativeInteger( true ); // $ExpectError
34+
isNegativeInteger( false ); // $ExpectError
35+
isNegativeInteger( null ); // $ExpectError
36+
isNegativeInteger( undefined ); // $ExpectError
37+
isNegativeInteger( [] ); // $ExpectError
38+
isNegativeInteger( {} ); // $ExpectError
39+
isNegativeInteger( ( x: number ): number => x ); // $ExpectError
40+
}
41+
42+
// The compiler throws an error if the function is provided an unsupported number of arguments...
43+
{
44+
isNegativeInteger(); // $ExpectError
45+
isNegativeInteger( undefined, 123 ); // $ExpectError
46+
}

lib/node_modules/@stdlib/math/base/assert/is-negative-integer/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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 finite double-precision floating-point number is a nonnegative integer.
23+
*
24+
* ## Notes
25+
*
26+
* - The function assumes a finite number. If provided positive infinity, the function will return `true`, when, in fact, the result is undefined.
27+
* - The function does not distinguish between positive and negative zero.
28+
*
29+
* @param x - value to test
30+
* @returns boolean indicating whether the value is a nonnegative integer
31+
*
32+
* @example
33+
* var bool = isNonNegativeInteger( 1.0 );
34+
* // returns true
35+
*
36+
* @example
37+
* var bool = isNonNegativeInteger( 0.0 );
38+
* // returns true
39+
*
40+
* @example
41+
* var bool = isNonNegativeInteger( -10.0 );
42+
* // returns false
43+
*/
44+
declare function isNonNegativeInteger( x: number ): boolean;
45+
46+
47+
// EXPORTS //
48+
49+
export = isNonNegativeInteger;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 isNonNegativeInteger = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isNonNegativeInteger( 2 ); // $ExpectType boolean
27+
isNonNegativeInteger( 3.12 ); // $ExpectType boolean
28+
isNonNegativeInteger( -2 ); // $ExpectType boolean
29+
}
30+
31+
// The function does not compile if provided a value other than a number...
32+
{
33+
isNonNegativeInteger( true ); // $ExpectError
34+
isNonNegativeInteger( false ); // $ExpectError
35+
isNonNegativeInteger( null ); // $ExpectError
36+
isNonNegativeInteger( undefined ); // $ExpectError
37+
isNonNegativeInteger( [] ); // $ExpectError
38+
isNonNegativeInteger( {} ); // $ExpectError
39+
isNonNegativeInteger( ( x: number ): number => x ); // $ExpectError
40+
}
41+
42+
// The compiler throws an error if the function is provided an unsupported number of arguments...
43+
{
44+
isNonNegativeInteger(); // $ExpectError
45+
isNonNegativeInteger( undefined, 123 ); // $ExpectError
46+
}

lib/node_modules/@stdlib/math/base/assert/is-nonnegative-integer/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: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
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 finite double-precision floating-point number is a nonpositive integer.
23+
*
24+
* ## Notes
25+
*
26+
* - The function assumes a finite number. If provided negative infinity, the function will return `true`, when, in fact, the result is undefined.
27+
* - The function does not distinguish between positive and negative zero.
28+
*
29+
* @param x - value to test
30+
* @returns boolean indicating whether the value is a nonpositive integer
31+
*
32+
* @example
33+
* var bool = isNonPositiveInteger( -1.0 );
34+
* // returns true
35+
*
36+
* @example
37+
* var bool = isNonPositiveInteger( 0.0 );
38+
* // returns true
39+
*
40+
* @example
41+
* var bool = isNonPositiveInteger( 10.0 );
42+
* // returns false
43+
*/
44+
declare function isNonPositiveInteger( x: number ): boolean;
45+
46+
47+
// EXPORTS //
48+
49+
export = isNonPositiveInteger;
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
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 isNonPositiveInteger = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isNonPositiveInteger( 2 ); // $ExpectType boolean
27+
isNonPositiveInteger( 3.12 ); // $ExpectType boolean
28+
isNonPositiveInteger( -2 ); // $ExpectType boolean
29+
}
30+
31+
// The function does not compile if provided a value other than a number...
32+
{
33+
isNonPositiveInteger( true ); // $ExpectError
34+
isNonPositiveInteger( false ); // $ExpectError
35+
isNonPositiveInteger( null ); // $ExpectError
36+
isNonPositiveInteger( undefined ); // $ExpectError
37+
isNonPositiveInteger( [] ); // $ExpectError
38+
isNonPositiveInteger( {} ); // $ExpectError
39+
isNonPositiveInteger( ( x: number ): number => x ); // $ExpectError
40+
}
41+
42+
// The compiler throws an error if the function is provided an unsupported number of arguments...
43+
{
44+
isNonPositiveInteger(); // $ExpectError
45+
isNonPositiveInteger( undefined, 123 ); // $ExpectError
46+
}

lib/node_modules/@stdlib/math/base/assert/is-nonpositive-integer/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 finite double-precision floating-point number is a positive integer.
23+
*
24+
* ## Notes
25+
*
26+
* - The function assumes a finite number. If provided positive infinity, the function will return `true`, when, in fact, the result is undefined.
27+
*
28+
* @param x - value to test
29+
* @returns boolean indicating whether the value is a positive integer
30+
*
31+
* @example
32+
* var bool = isPositiveInteger( 1.0 );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isPositiveInteger( 0.0 );
37+
* // returns false
38+
*
39+
* @example
40+
* var bool = isPositiveInteger( -10.0 );
41+
* // returns false
42+
*/
43+
declare function isPositiveInteger( x: number ): boolean;
44+
45+
46+
// EXPORTS //
47+
48+
export = isPositiveInteger;

0 commit comments

Comments
 (0)