Skip to content

Commit 59455b6

Browse files
committed
docs: add toString, toJSON, and toDataView declarations to Z-test results packages
--- type: pre_commit_static_analysis_report description: Results of running static analysis checks when committing changes. report: - task: lint_filenames status: passed - task: lint_editorconfig status: passed - task: lint_markdown status: na - task: lint_package_json status: na - task: lint_repl_help status: na - task: lint_javascript_src status: na - task: lint_javascript_cli status: na - task: lint_javascript_examples status: na - task: lint_javascript_tests status: na - task: lint_javascript_benchmarks status: na - task: lint_python status: na - task: lint_r status: na - task: lint_c_src status: na - task: lint_c_examples status: na - task: lint_c_benchmarks status: na - task: lint_c_tests_fixtures status: na - task: lint_shell status: na - task: lint_typescript_declarations status: passed - task: lint_typescript_tests status: passed - task: lint_license_headers status: passed ---
1 parent 0a437aa commit 59455b6

File tree

12 files changed

+671
-8
lines changed

12 files changed

+671
-8
lines changed

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/factory/docs/types/index.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ interface Results<T> {
6868
sd?: number;
6969
}
7070

71+
/**
72+
* Interface describing options when serializing a results object to a string.
73+
*/
74+
interface ToStringOptions {
75+
/**
76+
* Number of digits to display after decimal points. Default: `4`.
77+
*/
78+
digits?: number;
79+
80+
/**
81+
* Boolean indicating whether to show the test decision. Default: `true`.
82+
*/
83+
decision?: boolean;
84+
}
85+
7186
/**
7287
* Interface describing a results data structure.
7388
*/
@@ -126,6 +141,28 @@ declare class ResultsStruct<T> {
126141
* Test method.
127142
*/
128143
method: string;
144+
145+
/**
146+
* Serializes a results object as a formatted string.
147+
*
148+
* @param options - options object
149+
* @returns serialized results
150+
*/
151+
toString( options?: ToStringOptions ): string;
152+
153+
/**
154+
* Serializes a results object as a JSON object.
155+
*
156+
* @returns serialized object
157+
*/
158+
toJSON(): object;
159+
160+
/**
161+
* Returns a DataView of a results object.
162+
*
163+
* @returns DataView
164+
*/
165+
toDataView(): DataView;
129166
}
130167

131168
/**

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/factory/docs/types/test.ts

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import resultsFactory = require( './index' );
5353
const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct<Float64Array>
5454
}
5555

56-
// The returned constructor can be invoked without `new`...
56+
// The returned function can be invoked without `new`...
5757
{
5858
const Results = resultsFactory( 'float64' );
5959

@@ -171,3 +171,31 @@ import resultsFactory = require( './index' );
171171
new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
172172
new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
173173
}
174+
175+
// The results object has a `toString` method...
176+
{
177+
const Results = resultsFactory( 'float64' );
178+
const r = new Results( {} );
179+
180+
r.toString(); // $ExpectType string
181+
r.toString( {} ); // $ExpectType string
182+
r.toString( { 'digits': 4 } ); // $ExpectType string
183+
r.toString( { 'decision': true } ); // $ExpectType string
184+
r.toString( { 'digits': 4, 'decision': true } ); // $ExpectType string
185+
}
186+
187+
// The results object has a `toJSON` method...
188+
{
189+
const Results = resultsFactory( 'float64' );
190+
const r = new Results( {} );
191+
192+
r.toJSON(); // $ExpectType object
193+
}
194+
195+
// The results object has a `toDataView` method...
196+
{
197+
const Results = resultsFactory( 'float64' );
198+
const r = new Results( {} );
199+
200+
r.toDataView(); // $ExpectType DataView
201+
}

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/float32/docs/types/index.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ interface Results {
6868
sd?: number;
6969
}
7070

71+
/**
72+
* Interface describing options when serializing a results object to a string.
73+
*/
74+
interface ToStringOptions {
75+
/**
76+
* Number of digits to display after decimal points. Default: `4`.
77+
*/
78+
digits?: number;
79+
80+
/**
81+
* Boolean indicating whether to show the test decision. Default: `true`.
82+
*/
83+
decision?: boolean;
84+
}
85+
7186
/**
7287
* Interface describing a results data structure.
7388
*/
@@ -126,6 +141,28 @@ declare class ResultsStruct {
126141
* Test method.
127142
*/
128143
method: string;
144+
145+
/**
146+
* Serializes a results object as a formatted string.
147+
*
148+
* @param options - options object
149+
* @returns serialized results
150+
*/
151+
toString( options?: ToStringOptions ): string;
152+
153+
/**
154+
* Serializes a results object as a JSON object.
155+
*
156+
* @returns serialized object
157+
*/
158+
toJSON(): object;
159+
160+
/**
161+
* Returns a DataView of a results object.
162+
*
163+
* @returns DataView
164+
*/
165+
toDataView(): DataView;
129166
}
130167

131168
/**

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/float32/docs/types/test.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Results = require( './index' );
2121

2222
// TESTS //
2323

24-
// The constructor returns a results object...
24+
// The function returns a results object...
2525
{
2626
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2727
const r0 = new Results( {} ); // $ExpectType ResultsStruct
@@ -36,7 +36,7 @@ import Results = require( './index' );
3636
const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
3737
}
3838

39-
// The constructor can be invoked without `new`...
39+
// The function can be invoked without `new`...
4040
{
4141
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4242
const r0 = Results( {} ); // $ExpectType ResultsStruct
@@ -115,3 +115,28 @@ import Results = require( './index' );
115115
new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
116116
new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
117117
}
118+
119+
// The results object has a `toString` method...
120+
{
121+
const r = new Results( {} );
122+
123+
r.toString(); // $ExpectType string
124+
r.toString( {} ); // $ExpectType string
125+
r.toString( { 'digits': 4 } ); // $ExpectType string
126+
r.toString( { 'decision': true } ); // $ExpectType string
127+
r.toString( { 'digits': 4, 'decision': true } ); // $ExpectType string
128+
}
129+
130+
// The results object has a `toJSON` method...
131+
{
132+
const r = new Results( {} );
133+
134+
r.toJSON(); // $ExpectType object
135+
}
136+
137+
// The results object has a `toDataView` method...
138+
{
139+
const r = new Results( {} );
140+
141+
r.toDataView(); // $ExpectType DataView
142+
}

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/float64/docs/types/index.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,21 @@ interface Results {
6868
sd?: number;
6969
}
7070

71+
/**
72+
* Interface describing options when serializing a results object to a string.
73+
*/
74+
interface ToStringOptions {
75+
/**
76+
* Number of digits to display after decimal points. Default: `4`.
77+
*/
78+
digits?: number;
79+
80+
/**
81+
* Boolean indicating whether to show the test decision. Default: `true`.
82+
*/
83+
decision?: boolean;
84+
}
85+
7186
/**
7287
* Interface describing a results data structure.
7388
*/
@@ -126,6 +141,28 @@ declare class ResultsStruct {
126141
* Test method.
127142
*/
128143
method: string;
144+
145+
/**
146+
* Serializes a results object as a formatted string.
147+
*
148+
* @param options - options object
149+
* @returns serialized results
150+
*/
151+
toString( options?: ToStringOptions ): string;
152+
153+
/**
154+
* Serializes a results object as a JSON object.
155+
*
156+
* @returns serialized object
157+
*/
158+
toJSON(): object;
159+
160+
/**
161+
* Returns a DataView of a results object.
162+
*
163+
* @returns DataView
164+
*/
165+
toDataView(): DataView;
129166
}
130167

131168
/**

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/float64/docs/types/test.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Results = require( './index' );
2121

2222
// TESTS //
2323

24-
// The constructor returns a results object...
24+
// The function returns a results object...
2525
{
2626
// eslint-disable-next-line @typescript-eslint/no-unused-vars
2727
const r0 = new Results( {} ); // $ExpectType ResultsStruct
@@ -36,7 +36,7 @@ import Results = require( './index' );
3636
const r3 = new Results( new ArrayBuffer( 80 ), 8, 16 ); // $ExpectType ResultsStruct
3737
}
3838

39-
// The constructor can be invoked without `new`...
39+
// The function can be invoked without `new`...
4040
{
4141
// eslint-disable-next-line @typescript-eslint/no-unused-vars
4242
const r0 = Results( {} ); // $ExpectType ResultsStruct
@@ -115,3 +115,28 @@ import Results = require( './index' );
115115
new Results( new ArrayBuffer( 80 ), 8, {} ); // $ExpectError
116116
new Results( new ArrayBuffer( 80 ), 8, ( x: number ): number => x ); // $ExpectError
117117
}
118+
119+
// The results object has a `toString` method...
120+
{
121+
const r = new Results( {} );
122+
123+
r.toString(); // $ExpectType string
124+
r.toString( {} ); // $ExpectType string
125+
r.toString( { 'digits': 4 } ); // $ExpectType string
126+
r.toString( { 'decision': true } ); // $ExpectType string
127+
r.toString( { 'digits': 4, 'decision': true } ); // $ExpectType string
128+
}
129+
130+
// The results object has a `toJSON` method...
131+
{
132+
const r = new Results( {} );
133+
134+
r.toJSON(); // $ExpectType object
135+
}
136+
137+
// The results object has a `toDataView` method...
138+
{
139+
const r = new Results( {} );
140+
141+
r.toDataView(); // $ExpectType DataView
142+
}

lib/node_modules/@stdlib/stats/base/ztest/two-sample/results/factory/docs/types/index.d.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,21 @@ interface Results<T> {
7373
ymean?: number;
7474
}
7575

76+
/**
77+
* Interface describing options when serializing a results object to a string.
78+
*/
79+
interface ToStringOptions {
80+
/**
81+
* Number of digits to display after decimal points. Default: `4`.
82+
*/
83+
digits?: number;
84+
85+
/**
86+
* Boolean indicating whether to show the test decision. Default: `true`.
87+
*/
88+
decision?: boolean;
89+
}
90+
7691
/**
7792
* Interface describing a results data structure.
7893
*/
@@ -136,6 +151,28 @@ declare class ResultsStruct<T> {
136151
* Test method.
137152
*/
138153
method: string;
154+
155+
/**
156+
* Serializes a results object as a formatted string.
157+
*
158+
* @param options - options object
159+
* @returns serialized results
160+
*/
161+
toString( options?: ToStringOptions ): string;
162+
163+
/**
164+
* Serializes a results object as a JSON object.
165+
*
166+
* @returns serialized object
167+
*/
168+
toJSON(): object;
169+
170+
/**
171+
* Returns a DataView of a results object.
172+
*
173+
* @returns DataView
174+
*/
175+
toDataView(): DataView;
139176
}
140177

141178
/**

0 commit comments

Comments
 (0)