Skip to content

Commit e9f4863

Browse files
committed
Add TypeScript definition
1 parent 62c2c7a commit e9f4863

3 files changed

Lines changed: 82 additions & 0 deletions

File tree

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
// MAIN //
22+
23+
/**
24+
* Evaluates the natural logarithm.
25+
*
26+
* @param {NonNegativeNumber} x - input value
27+
* @returns {number} function value
28+
*
29+
* @example
30+
* var v = ln( 4.0 );
31+
* // returns ~1.386
32+
*
33+
* @example
34+
* var v = ln( 0.0 );
35+
* // returns -Infinity
36+
*
37+
* @example
38+
* var v = ln( Infinity );
39+
* // returns Infinity
40+
*
41+
* @example
42+
* var v = ln( NaN );
43+
* // returns NaN
44+
*
45+
* @example
46+
* var v = ln( -4.0 );
47+
* // returns NaN
48+
*/
49+
declare function ln( x: number ): number;
50+
51+
52+
// EXPORTS //
53+
54+
export = ln;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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 ln = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
ln( 8 ); // $ExpectType number
25+
ln( [] ); // $ExpectError
26+
ln( {} ); // $ExpectError
27+
ln(); // $ExpectError

lib/node_modules/@stdlib/math/base/special/ln/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"test": "./test"
2424
},
2525
"scripts": {},
26+
"types": "./docs/types",
2627
"homepage": "https://github.com/stdlib-js/stdlib",
2728
"repository": {
2829
"type": "git",

0 commit comments

Comments
 (0)