Skip to content

Commit 71dea5e

Browse files
committed
Auto-generated commit
1 parent bfe2797 commit 71dea5e

File tree

3 files changed

+54
-24
lines changed

3 files changed

+54
-24
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2025-06-21)
7+
## Unreleased (2025-06-22)
88

99
<section class="features">
1010

@@ -213,6 +213,7 @@ A total of 32 issues were closed in this release:
213213

214214
<details>
215215

216+
- [`74f2d2f`](https://github.com/stdlib-js/stdlib/commit/74f2d2fbf3eb548d043ef8c67c66120a67d97e17) - **refactor:** move function to file _(by Athan Reines)_
216217
- [`7f0421e`](https://github.com/stdlib-js/stdlib/commit/7f0421e54502fdd9e92758d9c9123216372287fd) - **feat:** add inital implementation of `array/struct-factory` _(by Athan Reines)_
217218
- [`4252199`](https://github.com/stdlib-js/stdlib/commit/42521999bf5751baf748fb1e9528c9c4b31a9116) - **fix:** ensure byte offset is a multiple of data type byte length _(by Athan Reines)_
218219
- [`4951a9d`](https://github.com/stdlib-js/stdlib/commit/4951a9dabc0a1cd2a9a93d8db024538db302b801) - **refactor:** tighten types _(by Athan Reines)_
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;

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( './../../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)