feat: add @stdlib/ndarray/to-locale-string#10898
feat: add @stdlib/ndarray/to-locale-string#10898headlessNode wants to merge 7 commits intostdlib-js:developfrom
@stdlib/ndarray/to-locale-string#10898Conversation
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: passed
- task: lint_repl_help
status: passed
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
Coverage Report
The above coverage report was generated for the changes in this PR. |
lib/node_modules/@stdlib/ndarray/to-locale-string/docs/types/index.d.ts
Outdated
Show resolved
Hide resolved
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Signed-off-by: Athan <kgryte@gmail.com>
lib/node_modules/@stdlib/ndarray/to-locale-string/docs/repl.txt
Outdated
Show resolved
Hide resolved
Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
| 'set': noop | ||
| }; | ||
|
|
||
| expected = 'ndarray( \'float64\', new Float64Array( [ 3, 5, 4, 6 ] ), [ 2, 2 ], [ 1, 2 ], 0, \'column-major\' )'; |
| t.end(); | ||
|
|
||
| function getter( i, j ) { | ||
| return arr.data[ arr.offset+sub2ind( [ 2, 2 ], i, j ) ]; |
There was a problem hiding this comment.
I am not sure why this is the approach was used for resolving a linear index because it is wrong. sub2ind resolves a view index, not a buffer index. For that you need to use vind2bind. But even then, just compute the index manually using strides. I believe you did this elsewhere.
| t.end(); | ||
|
|
||
| function getter( i, j ) { | ||
| return arr.data.get( arr.offset+sub2ind( [ 2, 2 ], i, j ) ); |
There was a problem hiding this comment.
Same comment as above and throughout this file.
| t.strictEqual( typeof actual, 'string', 'returns expected value' ); | ||
| t.notEqual( actual.indexOf( '...' ), -1, 'contains ellipsis' ); | ||
| t.notEqual( actual.indexOf( '0, 1, 2' ), -1, 'contains first three values' ); | ||
| t.notEqual( actual.indexOf( '98, 99, 100' ), -1, 'contains last three values' ); |
|
|
||
| actual = ndarray2localeString( arr ); | ||
| t.strictEqual( typeof actual, 'string', 'returns expected value' ); | ||
| t.notEqual( actual.indexOf( '...' ), -1, 'contains ellipsis' ); |
There was a problem hiding this comment.
This is wrong. Did you review these tests to ensure they made sense?
| t.end(); | ||
|
|
||
| function getter( i, j ) { | ||
| return arr.data[ arr.offset+sub2ind( [ 2, 2 ], i, j ) ]; |
There was a problem hiding this comment.
Same comment as above regarding sub2ind.
Signed-off-by: Athan <kgryte@gmail.com>
| <!-- eslint no-undef: "error" --> | ||
|
|
||
| ```javascript | ||
| var shape2strides = require( '@stdlib/ndarray/base/shape2strides' ); |
There was a problem hiding this comment.
For a top-level package, I don't find this example particularly compelling. Instead, I suggest simplifying and simply (1) using, say, random/uniform to generate an ndarray of random values and (2) serializing that ndarray to a string using different locale identifiers (e.g., for English, German, etc) and potentially different configuration options (e.g., maximum number of digits, etc).
There was a problem hiding this comment.
And I think it would be useful to use doctest return annotations for console.log statements to show the expected output. This would allow readers to develop a visual intuition regarding expected output.
There was a problem hiding this comment.
This comment also applies to the corresponding example file.
|
For METR, |
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes. report:
Resolves stdlib-js/metr-issue-tracker#189.
Description
This pull request:
@stdlib/ndarray/to-locale-stringRelated Issues
This pull request has the following related issues:
ndarray/to-locale-stringmetr-issue-tracker#189Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
Primarily written by Claude Code.
@stdlib-js/reviewers