Skip to content

Commit 14f50ed

Browse files
committed
feat: docs added
1 parent 2f1dc72 commit 14f50ed

File tree

4 files changed

+131
-1
lines changed

4 files changed

+131
-1
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
2+
{{alias}}( x )
3+
Tests if a finite single-precision floating-point
4+
numeric value is an odd number.
5+
6+
The function assumes a finite number. If provided positive or negative
7+
infinity, the function will return `true`, when, in fact, the result is
8+
undefined.
9+
10+
Parameters
11+
----------
12+
x: number
13+
Value to test.
14+
15+
Returns
16+
-------
17+
bool: boolean
18+
Boolean indicating whether the value is an odd number.
19+
20+
Examples
21+
--------
22+
> var bool = {{alias}}( 5.0 )
23+
true
24+
> bool = {{alias}}( -2.0 )
25+
false
26+
> bool = {{alias}}( 0.0 )
27+
false
28+
> bool = {{alias}}( NaN )
29+
false
30+
31+
See Also
32+
--------
33+
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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: 4.1
20+
21+
/**
22+
* Tests if a finite single-precision floating-point numeric value is an odd number.
23+
*
24+
* ## Notes
25+
*
26+
* - The function assumes a finite number. If provided positive or 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 an odd number
30+
*
31+
* @example
32+
* var bool = isOddf( 5.0 );
33+
* // returns true
34+
*
35+
* @example
36+
* var bool = isOddf( -2.0 );
37+
* // returns false
38+
*
39+
* @example
40+
* var bool = isOddf( 0.0 );
41+
* // returns false
42+
*
43+
* @example
44+
* var bool = isOddf( NaN );
45+
* // returns false
46+
*/
47+
declare function isOddf( x: number ): boolean;
48+
49+
50+
// EXPORTS //
51+
52+
export = isOddf;
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
/*
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2024 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 isOddf = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns a boolean...
25+
{
26+
isOddf( 2 ); // $ExpectType boolean
27+
isOddf( 3 ); // $ExpectType boolean
28+
}
29+
30+
// The compiler throws an error if the function is provided a value other than a number...
31+
{
32+
isOddf( true ); // $ExpectError
33+
isOddf( false ); // $ExpectError
34+
isOddf( null ); // $ExpectError
35+
isOddf( undefined ); // $ExpectError
36+
isOddf( [] ); // $ExpectError
37+
isOddf( {} ); // $ExpectError
38+
isOddf( ( x: number ): number => x ); // $ExpectError
39+
}
40+
41+
// The compiler throws an error if the function is provided an unsupported number of arguments...
42+
{
43+
isOddf(); // $ExpectError
44+
isOddf( undefined, 123 ); // $ExpectError
45+
}

lib/node_modules/@stdlib/math/base/assert/is-oddf/test/test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @license Apache-2.0
33
*
4-
* Copyright (c) 2018 The Stdlib Authors.
4+
* Copyright (c) 2024 The Stdlib Authors.
55
*
66
* Licensed under the Apache License, Version 2.0 (the "License");
77
* you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)