Skip to content

Commit 76f58a1

Browse files
committed
Auto-generated commit
1 parent 231e0a6 commit 76f58a1

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

CHANGELOG.md

+24-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
55
<section class="release" id="unreleased">
66

7-
## Unreleased (2024-12-28)
7+
## Unreleased (2024-12-29)
88

99
<section class="packages">
1010

@@ -50,6 +50,28 @@
5050

5151
<!-- /.package -->
5252

53+
<section class="package" id="ndarray-array-unreleased">
54+
55+
#### [@stdlib/ndarray/array](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/array)
56+
57+
<details>
58+
59+
<section class="bug-fixes">
60+
61+
##### Bug Fixes
62+
63+
- [`be3e0b9`](https://github.com/stdlib-js/stdlib/commit/be3e0b984eb981caa758172dc7179cbd6a118a2e) - treat generic accessor arrays similar to built-in generic arrays
64+
65+
</section>
66+
67+
<!-- /.bug-fixes -->
68+
69+
</details>
70+
71+
</section>
72+
73+
<!-- /.package -->
74+
5375
<section class="package" id="ndarray-base-unreleased">
5476

5577
#### [@stdlib/ndarray/base](https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/ndarray/base)
@@ -455,6 +477,7 @@ A total of 3 people contributed to this release. Thank you to the following cont
455477

456478
<details>
457479

480+
- [`be3e0b9`](https://github.com/stdlib-js/stdlib/commit/be3e0b984eb981caa758172dc7179cbd6a118a2e) - **fix:** treat generic accessor arrays similar to built-in generic arrays _(by Athan Reines)_
458481
- [`8f2808d`](https://github.com/stdlib-js/stdlib/commit/8f2808dec8c8a6508841e86453fba823823efc6c) - **docs:** update related packages sections [(#4302)](https://github.com/stdlib-js/stdlib/pull/4302) _(by stdlib-bot)_
459482
- [`4a70790`](https://github.com/stdlib-js/stdlib/commit/4a707903dfef7c2b56216000165706497d19a251) - **style:** add missing spaces _(by Philipp Burckhardt)_
460483
- [`acb12c7`](https://github.com/stdlib-js/stdlib/commit/acb12c77fd8eca09956f62e052f79ce1a0d9c1d0) - **refactor:** improve type specificity for array provided to callback _(by Athan Reines)_

array/lib/main.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ function array() {
165165
btype = getDType( buffer );
166166
FLG = true;
167167
} else {
168-
btype = getBufferDType( buffer );
168+
btype = getBufferDType( buffer ) || 'generic'; // fallback to a "generic" dtype when provided, e.g., a generic accessor array as a data source
169169
FLG = false;
170170
}
171171
}
@@ -208,7 +208,7 @@ function array() {
208208
if ( btype && !isAllowedCast( btype, dtype, opts.casting ) ) {
209209
throw new Error( format( 'invalid option. Data type cast is not allowed. Casting mode: `%s`. From: `%s`. To: `%s`.', opts.casting, btype, dtype ) );
210210
}
211-
} else if ( btype ) {
211+
} else if ( btype ) { // btype !== void 0
212212
// TODO: reconcile difference in behavior when provided a generic array and no `dtype` option. Currently, we cast here, but do not allow casting a generic array (by default) when explicitly providing a `dtype` option.
213213

214214
// Only cast generic array data sources when not provided an ndarray...
@@ -320,7 +320,7 @@ function array() {
320320
}
321321
}
322322
} else if ( buffer ) {
323-
if ( btype === 'generic' && opts.flatten ) {
323+
if ( btype === 'generic' && opts.flatten && isArray( buffer ) ) {
324324
buffer = flatten( buffer, osh || arrayShape( buffer ), order === 'column-major' );
325325
}
326326
if ( buffer.length !== len ) {

0 commit comments

Comments
 (0)