Skip to content

Commit a89315c

Browse files
committed
Auto-generated commit
1 parent 5545b6f commit a89315c

13 files changed

Lines changed: 867 additions & 294 deletions

File tree

.github/.keepalive

Lines changed: 0 additions & 1 deletion
This file was deleted.

CHANGELOG.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,51 @@
22

33
> Package changelog.
44
5+
<section class="release" id="unreleased">
6+
7+
## Unreleased (2026-02-27)
8+
9+
<section class="features">
10+
11+
### Features
12+
13+
- [`793a38c`](https://github.com/stdlib-js/stdlib/commit/793a38c29f31677807e0cf6748f1ca54fbbef4ec) - add `toLocaleString` method to `ndarray/base/ctor` [(#9435)](https://github.com/stdlib-js/stdlib/pull/9435)
14+
15+
</section>
16+
17+
<!-- /.features -->
18+
19+
<section class="commits">
20+
21+
### Commits
22+
23+
<details>
24+
25+
- [`793a38c`](https://github.com/stdlib-js/stdlib/commit/793a38c29f31677807e0cf6748f1ca54fbbef4ec) - **feat:** add `toLocaleString` method to `ndarray/base/ctor` [(#9435)](https://github.com/stdlib-js/stdlib/pull/9435) _(by Muhammad Haris, Athan Reines)_
26+
27+
</details>
28+
29+
</section>
30+
31+
<!-- /.commits -->
32+
33+
<section class="contributors">
34+
35+
### Contributors
36+
37+
A total of 2 people contributed to this release. Thank you to the following contributors:
38+
39+
- Athan Reines
40+
- Muhammad Haris
41+
42+
</section>
43+
44+
<!-- /.contributors -->
45+
46+
</section>
47+
48+
<!-- /.release -->
49+
550
<section class="release" id="v0.3.1">
651

752
## 0.3.1 (2026-02-08)

README.md

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -543,11 +543,44 @@ var d = arr.data;
543543

544544
For zero-dimensional arrays, the first, and **only**, argument should be the value `v` to set. The method returns the `ndarray` instance.
545545

546+
<a name="method-to-locale-string"></a>
547+
548+
#### ndarray.prototype.toLocaleString( \[locales\[, options]] )
549+
550+
Serializes an `ndarray` as a locale-specific string.
551+
552+
```javascript
553+
// Specify the array configuration:
554+
var buffer = [ 1234.567, 9876.543, 1111.222, 3333.444 ];
555+
var shape = [ 2, 2 ];
556+
var order = 'row-major';
557+
var strides = [ 2, 1 ];
558+
var offset = 0;
559+
560+
// Create a new ndarray:
561+
var arr = ndarray( 'generic', buffer, shape, strides, offset, order );
562+
563+
// Serialize to a locale-specific string:
564+
var str = arr.toLocaleString( 'en-US' );
565+
// returns "ndarray( 'generic', [ 1,234.567, 9,876.543, 1,111.222, 3,333.444 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' )"
566+
567+
// Use German locale:
568+
str = arr.toLocaleString( 'de-DE' );
569+
// returns "ndarray( 'generic', [ 1.234,567, 9.876,543, 1.111,222, 3.333,444 ], [ 2, 2 ], [ 2, 1 ], 0, 'row-major' )"
570+
```
571+
572+
The method accepts the following arguments:
573+
574+
- **locales**: a string with a BCP 47 language tag or an array of such strings.
575+
- **options**: configuration properties.
576+
577+
The method does **not** serialize data outside of the buffer region defined by the array configuration.
578+
546579
<a name="method-to-string"></a>
547580

548581
#### ndarray.prototype.toString()
549582

550-
Serializes an `ndarray` as a `string`.
583+
Serializes an `ndarray` as a string.
551584

552585
```javascript
553586
// Specify the array configuration:

0 commit comments

Comments
 (0)