Skip to content

Commit f3f96d8

Browse files
committed
Add Typescript definition and remove empty lines
1 parent abd9678 commit f3f96d8

File tree

4 files changed

+170
-2
lines changed

4 files changed

+170
-2
lines changed

lib/node_modules/@stdlib/assert/is-electron-main/docs/types/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* var bool = IS_ELECTRON_MAIN;
2626
* // returns <boolean>
2727
*/
28-
2928
declare const IS_ELECTRON_MAIN: boolean;
3029

3130

lib/node_modules/@stdlib/assert/is-electron-renderer/docs/types/index.d.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
* var bool = IS_ELECTRON_RENDERER;
2626
* // returns <boolean>
2727
*/
28-
2928
declare const IS_ELECTRON_RENDERER: boolean;
3029

3130

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
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+
* Interface defining `isNegativeNumberArray` with methods for testing for primitive and object arrays, respectively.
23+
*/
24+
interface CheckNegativeNumberArray {
25+
/**
26+
* Tests if a value is an array-like object containing only negative numbers.
27+
*
28+
* @param value - value to test
29+
* @returns boolean indicating whether value is an array-like object containing only negative numbers
30+
*
31+
* @example
32+
* var bool = isNegativeNumberArray( [ -3.7, new Number(-3.0) ] );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isNegativeNumberArray( [ -3.0, '-3.0' ] );
37+
* // returns false
38+
*/
39+
( value: any ): boolean;
40+
41+
/**
42+
* Tests if a value is an array-like object containing only negative primitive number values.
43+
*
44+
* @param value - value to test
45+
* @returns boolean indicating whether value is an array-like object containing only negative primitive number values
46+
*
47+
* @example
48+
* var bool = isNegativeNumberArray.primitives( [ -1.0, -10.0 ] );
49+
* // returns true
50+
*
51+
* @example
52+
* var bool = isNegativeNumberArray.primitives( [ -1.0, 0.0, -10.0 ] );
53+
* // returns false
54+
*
55+
* @example
56+
* var bool = isNegativeNumberArray.primitives( [ -3.0, new Number(-1.0) ] );
57+
* // returns false
58+
*/
59+
primitives( value: any ): boolean;
60+
61+
/**
62+
* Tests if a value is an array-like object containing only number objects having negative number values.
63+
*
64+
* @param value - value to test
65+
* @returns boolean indicating whether value is an array-like object containing only number objects having negative number values
66+
*
67+
* @example
68+
* var bool = isNegativeNumberArray.objects( [ new Number(-1.3), new Number(-10.8) ] );
69+
* // returns true
70+
*
71+
* @example
72+
* var bool = isNegativeNumberArray.objects( [ -1.0, 0.0, -10.0 ] );
73+
* // returns false
74+
*
75+
* @example
76+
* var bool = isNegativeNumberArray.objects( [ -3.0, new Number(-1.0) ] );
77+
* // returns false
78+
*/
79+
objects( value: any ): boolean;
80+
}
81+
82+
/**
83+
* Tests if a value is an array-like object containing only negative numbers.
84+
*
85+
* @param value - value to test
86+
* @returns boolean indicating whether value is an array-like object containing only negative numbers
87+
*
88+
* @example
89+
* var bool = isNegativeNumberArray( [ -3.7, new Number(-3.0) ] );
90+
* // returns true
91+
*
92+
* @example
93+
* var bool = isNegativeNumberArray( [ -3.7, '-3.0' ] );
94+
* // returns false
95+
*
96+
* @example
97+
* var bool = isNegativeNumberArray.primitives( [ -1.3, -10.0 ] );
98+
* // returns true
99+
*
100+
* @example
101+
* var bool = isNegativeNumberArray.objects( [ new Number(-1.3), new Number(-10.0) ] );
102+
* // returns true
103+
*/
104+
declare var isNegativeNumberArray: CheckNegativeNumberArray;
105+
106+
107+
// EXPORTS //
108+
109+
export = isNegativeNumberArray;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2021 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 isNegativeNumberArray = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isNegativeNumberArray( [ 4 ] ); // $ExpectType boolean
27+
isNegativeNumberArray( [ -2.9 ] ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided an unsupported number of arguments...
31+
{
32+
isNegativeNumberArray(); // $ExpectError
33+
isNegativeNumberArray( [ -3 ], 123 ); // $ExpectError
34+
}
35+
36+
// Attached to main export is a `primitives` method which returns a boolean...
37+
{
38+
// tslint:disable-next-line:no-construct
39+
isNegativeNumberArray.primitives( [ new Number( -3 ) ] ); // $ExpectType boolean
40+
isNegativeNumberArray.primitives( [ -3 ] ); // $ExpectType boolean
41+
}
42+
43+
// The compiler throws an error if the `primitives` method is provided an unsupported number of arguments...
44+
{
45+
isNegativeNumberArray.primitives(); // $ExpectError
46+
isNegativeNumberArray.primitives( [ -2 ], 123 ); // $ExpectError
47+
}
48+
49+
50+
// Attached to main export is an `objects` method which returns a boolean...
51+
{
52+
// tslint:disable-next-line:no-construct
53+
isNegativeNumberArray.objects( [ new Number( -2 ) ] ); // $ExpectType boolean
54+
isNegativeNumberArray.objects( [ -2 ] ); // $ExpectType boolean
55+
}
56+
57+
// The compiler throws an error if the `objects` method is provided an unsupported number of arguments...
58+
{
59+
isNegativeNumberArray.objects(); // $ExpectError
60+
isNegativeNumberArray.objects( [ -2 ], 123 ); // $ExpectError
61+
}

0 commit comments

Comments
 (0)