Skip to content

Commit 599d5ac

Browse files
committed
Add Typescript definition
1 parent fafb094 commit 599d5ac

File tree

5 files changed

+84
-3
lines changed

5 files changed

+84
-3
lines changed

lib/node_modules/@stdlib/stats/ztest/docs/types/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ interface Output {
107107
* @param options.alpha - significance level (default: 0.05)
108108
* @param options.alternative - alternative hypothesis (`two-sided`, `less` or `greater`; default: 'two-sided')
109109
* @param options.mu - mean under H0 (default: 0)
110-
* @throws sigma argument has to be a positive number
110+
* @throws sigma argument must be a positive number
111111
* @throws must provide valid options
112112
* @returns test result object
113113
*

lib/node_modules/@stdlib/stats/ztest2/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ interface Output {
114114
* @param options.alpha - significance level (default: 0.05)
115115
* @param options.alternative - alternative hypothesis (`two-sided`, `less` or `greater`; default: 'two-sided')
116116
* @param options.difference - difference in means under H0 (default: 0)
117-
* @throws sigmax argument has to be a positive number
118-
* @throws sigmay argument has to be a positive number
117+
* @throws sigmax argument must be a positive number
118+
* @throws sigmay argument must be a positive number
119119
* @throws must provide valid options
120120
* @returns test result object
121121
*
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
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+
// TypeScript Version: 2.0
20+
21+
/**
22+
* Creates an object from an array of key-value pairs.
23+
*
24+
* @param entries - input object
25+
* @returns object created from `[key, value]` pairs
26+
*
27+
* @example
28+
* var entries = [ ['beep', 'boop'], ['foo', 'bar'] ];
29+
*
30+
* var obj = objectFromEntries( entries );
31+
* // returns {'beep': 'boop', 'foo': 'bar'}
32+
*/
33+
declare function objectFromEntries( entries: Array<Array<any>> ): any;
34+
35+
36+
// EXPORTS //
37+
38+
export = objectFromEntries;
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) 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 objectFromEntries = require( './index' );
20+
21+
22+
// TESTS //
23+
24+
// The function returns an object...
25+
{
26+
objectFromEntries( [ ['beep', 'boop'], ['foo', 'bar'] ] ); // $ExpectType any
27+
}
28+
29+
// The compiler throws an error if the function is provided a first argument which is not an array of arrays...
30+
{
31+
objectFromEntries( 'abc' ); // $ExpectError
32+
objectFromEntries( 123 ); // $ExpectError
33+
objectFromEntries( true ); // $ExpectError
34+
objectFromEntries( false ); // $ExpectError
35+
objectFromEntries( {} ); // $ExpectError
36+
}
37+
38+
// The compiler throws an error if the function is provided an invalid number of arguments...
39+
{
40+
objectFromEntries(); // $ExpectError
41+
objectFromEntries( [ ['beep', 'boop'], ['foo', 'bar'] ], {} ); // $ExpectError
42+
}

lib/node_modules/@stdlib/utils/from-entries/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
"lib": "./lib",
2121
"test": "./test"
2222
},
23+
"types": "./docs/types",
2324
"scripts": {},
2425
"homepage": "https://github.com/stdlib-js/stdlib",
2526
"repository": {

0 commit comments

Comments
 (0)