Skip to content

Commit a53415f

Browse files
committed
Auto-generated commit
1 parent 075c674 commit a53415f

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,7 @@
566566

567567
### Bug Fixes
568568

569+
- [`0b89951`](https://github.com/stdlib-js/stdlib/commit/0b89951e22829e302f05d948ac8391d6300a39ea) - serialize the data type to a string and add comment
569570
- [`ebd5886`](https://github.com/stdlib-js/stdlib/commit/ebd5886f97aef9dad8daf7df0d850882a767ca6b) - preserve formatting of original string serialization and rename internal files
570571
- [`eab49ad`](https://github.com/stdlib-js/stdlib/commit/eab49ad435f6080ec28a8fbb75de4d9520bdd7e4) - ensure support for elements which are null or undefined
571572
- [`f10a6aa`](https://github.com/stdlib-js/stdlib/commit/f10a6aaf98c37bb630ac75e1a50dd0bd4a0eb417) - ensure unique indices
@@ -795,6 +796,7 @@ A total of 44 issues were closed in this release:
795796

796797
<details>
797798

799+
- [`0b89951`](https://github.com/stdlib-js/stdlib/commit/0b89951e22829e302f05d948ac8391d6300a39ea) - **fix:** serialize the data type to a string and add comment _(by Athan Reines)_
798800
- [`d02089a`](https://github.com/stdlib-js/stdlib/commit/d02089a716cf72e62eb60d54f909f0b439a05196) - **chore:** minor clean-up _(by Philipp Burckhardt)_
799801
- [`18f1915`](https://github.com/stdlib-js/stdlib/commit/18f191560f9322727ee126619e9e083187b64821) - **chore:** minor clean-up _(by Philipp Burckhardt)_
800802
- [`a4a5a00`](https://github.com/stdlib-js/stdlib/commit/a4a5a0071775e446d59fb7eb2553e850f1a84b26) - **bench:** refactor to use string interpolation in `ndarray/base/assign` [(#11019)](https://github.com/stdlib-js/stdlib/pull/11019) _(by Partha Das)_

base/ctor/lib/serialize2string.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,11 +114,11 @@ function serialize2string( ctx, method, locales, options ) {
114114
f = toStr;
115115
}
116116
ndims = ctx._shape.length;
117-
dt = ctx._dtype;
117+
dt = String( ctx._dtype );
118118
isCmplx = isComplexDataType( dt );
119119

120120
// Function to invoke to create an ndarray:
121-
str = format( 'ndarray( \'%s\', ', String( dt ) );
121+
str = format( 'ndarray( \'%s\', ', dt );
122122

123123
// Data buffer parameter...
124124
buffer = '';
@@ -180,7 +180,7 @@ function serialize2string( ctx, method, locales, options ) {
180180
}
181181
}
182182
}
183-
ctor = CTORS[ dt ];
183+
ctor = CTORS[ dt ] || CTORS[ 'generic' ]; // NOTE: we fallback to "generic" here, even though the underlying data buffer may be an exotic array type (e.g., struct array or specialized accessor array, etc). In which case, one would not be able to simply copy-paste the output string in order to create an equivalent ndarray, but this is likely okay, as such an end-user use case is likely not common.
184184
str += replace( ctor, '{{data}}', buffer );
185185
str += ', ';
186186

0 commit comments

Comments
 (0)