Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a7ef673

Browse files
committedDec 29, 2024·
Auto-generated commit
1 parent 7e3f5e3 commit a7ef673

File tree

4 files changed

+20
-8
lines changed

4 files changed

+20
-8
lines changed
 

‎CHANGELOG.md

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

7-
## Unreleased (2024-12-24)
7+
## Unreleased (2024-12-29)
8+
9+
<section class="bug-fixes">
10+
11+
### Bug Fixes
12+
13+
- [`be3e0b9`](https://github.com/stdlib-js/stdlib/commit/be3e0b984eb981caa758172dc7179cbd6a118a2e) - treat generic accessor arrays similar to built-in generic arrays
14+
15+
</section>
16+
17+
<!-- /.bug-fixes -->
818

919
<section class="commits">
1020

1121
### Commits
1222

1323
<details>
1424

25+
- [`be3e0b9`](https://github.com/stdlib-js/stdlib/commit/be3e0b984eb981caa758172dc7179cbd6a118a2e) - **fix:** treat generic accessor arrays similar to built-in generic arrays _(by Athan Reines)_
1526
- [`4a70790`](https://github.com/stdlib-js/stdlib/commit/4a707903dfef7c2b56216000165706497d19a251) - **style:** add missing spaces _(by Philipp Burckhardt)_
1627

1728
</details>
@@ -24,8 +35,9 @@
2435

2536
### Contributors
2637

27-
A total of 1 person contributed to this release. Thank you to this contributor:
38+
A total of 2 people contributed to this release. Thank you to the following contributors:
2839

40+
- Athan Reines
2941
- Philipp Burckhardt
3042

3143
</section>

‎dist/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎dist/index.js.map

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎lib/main.js

Lines changed: 3 additions & 3 deletions
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)
Please sign in to comment.