Skip to content

Commit 74f2d2f

Browse files
committed
refactor: move function to file
--- 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 d67b212 commit 74f2d2f

File tree

2 files changed

+52
-23
lines changed

2 files changed

+52
-23
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/**
2+
* @license Apache-2.0
3+
*
4+
* Copyright (c) 2025 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+
'use strict';
20+
21+
// MODULES //
22+
23+
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
24+
var isFunction = require( '@stdlib/assert/is-function' );
25+
26+
27+
// MAIN //
28+
29+
/**
30+
* Returns a boolean indicating if a value is a `struct` constructor.
31+
*
32+
* @private
33+
* @param {*} value - value to test
34+
* @returns {boolean} boolean indicating if a value is a `struct` constructor
35+
*/
36+
function isStructConstructor( value ) {
37+
return (
38+
isFunction( value ) &&
39+
isPositiveInteger( value.alignment ) &&
40+
isPositiveInteger( value.byteLength ) &&
41+
isFunction( value.byteLengthOf ) &&
42+
isFunction( value.byteOffsetOf ) &&
43+
isFunction( value.bufferOf ) &&
44+
isFunction( value.viewOf )
45+
);
46+
}
47+
48+
49+
// EXPORTS //
50+
51+
module.exports = isStructConstructor;

lib/node_modules/@stdlib/array/struct-factory/lib/main.js

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
// MODULES //
2424

2525
var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive;
26-
var isPositiveInteger = require( '@stdlib/assert/is-positive-integer' ).isPrimitive;
2726
var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive;
2827
var isArrayBuffer = require( '@stdlib/assert/is-arraybuffer' );
2928
var isCollection = require( '@stdlib/assert/is-collection' );
@@ -43,6 +42,7 @@ var accessorGetter = require( '@stdlib/array/base/accessor-getter' );
4342
var gcopy = require( '@stdlib/blas/base/gcopy' ).ndarray;
4443
var structFactory = require( '@stdlib/dstructs/struct' );
4544
var format = require( '@stdlib/string/format' );
45+
var isStructConstructor = require( './is_struct_constructor.js' );
4646
var fromArray = require( './from_array.js' );
4747
var fromIterator = require( './from_iterator.js' );
4848

@@ -53,28 +53,6 @@ var HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();
5353
var CTOR_NAME = 'StructArray';
5454

5555

56-
// FUNCTIONS //
57-
58-
/**
59-
* Returns a boolean indicating if a value is a `struct` constructor.
60-
*
61-
* @private
62-
* @param {*} value - value to test
63-
* @returns {boolean} boolean indicating if a value is a `struct` constructor
64-
*/
65-
function isStructConstructor( value ) {
66-
return (
67-
isFunction( value ) &&
68-
isPositiveInteger( value.alignment ) &&
69-
isPositiveInteger( value.byteLength ) &&
70-
isFunction( value.byteLengthOf ) &&
71-
isFunction( value.byteOffsetOf ) &&
72-
isFunction( value.bufferOf ) &&
73-
isFunction( value.viewOf )
74-
);
75-
}
76-
77-
7856
// MAIN //
7957

8058
/**

0 commit comments

Comments
 (0)