Skip to content

Commit c0967b9

Browse files
committed
feat: add static methods to prototype
--- 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: passed - 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: na - task: lint_typescript_tests status: na - task: lint_license_headers status: passed ---
1 parent 179f005 commit c0967b9

File tree

1 file changed

+148
-0
lines changed
  • lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/factory/lib

1 file changed

+148
-0
lines changed

lib/node_modules/@stdlib/stats/base/ztest/one-sample/results/factory/lib/main.js

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ var isObject = require( '@stdlib/assert/is-object' );
2727
var hasProp = require( '@stdlib/assert/has-property' );
2828
var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' );
2929
var setReadWriteAccessor = require( '@stdlib/utils/define-nonenumerable-read-write-accessor' );
30+
var setReadOnlyAccessor = require( '@stdlib/utils/define-nonenumerable-read-only-accessor' );
3031
var propertyDescriptor = require( '@stdlib/utils/property-descriptor' );
3132
var contains = require( '@stdlib/array/base/assert/contains' ).factory;
3233
var join = require( '@stdlib/array/base/join' );
@@ -149,6 +150,153 @@ function factory( dtype ) {
149150
*/
150151
inherit( Results, Struct );
151152

153+
/**
154+
* Constructor name.
155+
*
156+
* @private
157+
* @name name
158+
* @memberof Results
159+
* @readonly
160+
* @type {string}
161+
*/
162+
setReadOnly( Results, 'name', Struct.name );
163+
164+
/**
165+
* Alignment.
166+
*
167+
* @private
168+
* @name alignment
169+
* @memberof Results
170+
* @readonly
171+
* @type {PositiveInteger}
172+
*/
173+
setReadOnly( Results, 'alignment', Struct.alignment );
174+
175+
/**
176+
* Size (in bytes) of the `struct`.
177+
*
178+
* @private
179+
* @name byteLength
180+
* @memberof Results
181+
* @readonly
182+
* @type {PositiveInteger}
183+
*/
184+
setReadOnly( Results, 'byteLength', Struct.byteLength );
185+
186+
/**
187+
* Returns a list of `struct` fields.
188+
*
189+
* @private
190+
* @name fields
191+
* @memberof Results
192+
* @readonly
193+
* @type {Array<string>}
194+
*/
195+
setReadOnlyAccessor( Results, 'fields', function get() {
196+
return Struct.fields;
197+
});
198+
199+
/**
200+
* Returns a string corresponding to the `struct` layout.
201+
*
202+
* @private
203+
* @name layout
204+
* @memberof Results
205+
* @readonly
206+
* @type {string}
207+
*/
208+
setReadOnlyAccessor( Results, 'layout', function get() {
209+
return Struct.layout;
210+
});
211+
212+
/**
213+
* Returns the length, in bytes, of the value specified by the provided field name.
214+
*
215+
* @private
216+
* @name byteLengthOf
217+
* @memberof Results
218+
* @readonly
219+
* @type {Function}
220+
* @param {string} name - field name
221+
* @throws {Error} struct must have at least one field
222+
* @throws {TypeError} must provide a recognized field name
223+
* @returns {NonNegativeInteger} byte length
224+
*/
225+
setReadOnly( Results, 'byteLengthOf', Struct.byteLengthOf );
226+
227+
/**
228+
* Returns the offset, in bytes, from the beginning of a `struct` to the value specified by the provided field name.
229+
*
230+
* @private
231+
* @name byteOffsetOf
232+
* @memberof Results
233+
* @readonly
234+
* @type {Function}
235+
* @param {string} name - field name
236+
* @throws {Error} struct must have at least one field
237+
* @throws {TypeError} must provide a recognized field name
238+
* @returns {NonNegativeInteger} byte offset
239+
*/
240+
setReadOnly( Results, 'byteOffsetOf', Struct.byteOffsetOf );
241+
242+
/**
243+
* Returns the description associated with a provided field name.
244+
*
245+
* @private
246+
* @name descriptionOf
247+
* @memberof Results
248+
* @readonly
249+
* @type {Function}
250+
* @param {string} name - field name
251+
* @throws {Error} struct must have at least one field
252+
* @throws {TypeError} must provide a recognized field name
253+
* @returns {string} description
254+
*/
255+
setReadOnly( Results, 'descriptionOf', Struct.descriptionOf );
256+
257+
/**
258+
* Returns the type associated with a provided field name.
259+
*
260+
* @private
261+
* @name typeOf
262+
* @memberof Results
263+
* @readonly
264+
* @type {Function}
265+
* @param {string} name - field name
266+
* @throws {Error} struct must have at least one field
267+
* @throws {TypeError} must provide a recognized field name
268+
* @returns {(string|Object)} type
269+
*/
270+
setReadOnly( Results, 'typeOf', Struct.typeOf );
271+
272+
/**
273+
* Returns the underlying byte buffer of a `struct`.
274+
*
275+
* @private
276+
* @name bufferOf
277+
* @memberof Results
278+
* @readonly
279+
* @type {Function}
280+
* @param {Object} obj - struct instance
281+
* @throws {TypeError} must provide a `struct` instance
282+
* @returns {ArrayBuffer} underlying byte buffer
283+
*/
284+
setReadOnly( Results, 'bufferOf', Struct.bufferOf );
285+
286+
/**
287+
* Returns the underlying byte buffer of a `struct` as a `DataView`.
288+
*
289+
* @private
290+
* @name viewOf
291+
* @memberof Results
292+
* @readonly
293+
* @type {Function}
294+
* @param {Object} obj - struct instance
295+
* @throws {TypeError} must provide a `struct` instance
296+
* @returns {DataView} view of underlying byte buffer
297+
*/
298+
setReadOnly( Results, 'viewOf', Struct.viewOf );
299+
152300
/**
153301
* Test name.
154302
*

0 commit comments

Comments
 (0)