feat: add @stdlib/ndarray/base/nulls-like package#12143
Closed
Planeshifter wants to merge 4 commits into
Closed
Conversation
Adds a new package for creating null-filled ndarrays having the same shape and data type as a provided ndarray. Also registers `nullsLike` in the `@stdlib/ndarray/base` namespace and adds previously missing `nansLike` TypeScript declarations to the namespace. Closes https://github.com/stdlib-js/todo/issues/2775 https://claude.ai/code/session_01YYZtPc4pb2E7cJ6TV6JMQK
- Remove incorrect `@throws` JSDoc tags from `lib/main.js` (error handling is delegated to `emptyLike`/`fill`) - Remove "Must have a generic data type" constraint from `docs/repl.txt` (not enforced in code) - Simplify TypeScript declaration: remove orphaned generic parameter `T` https://claude.ai/code/session_01YYZtPc4pb2E7cJ6TV6JMQK
- Add test for recognized non-generic dtypes (float64, float32, int32, etc.) throwing a TypeError - Add instanceOf(Array) assertion on data buffers in each happy-path test - Add output-identity test (returned array is distinct from input) - Add input-mutation guard test (input data unchanged after call) - Add note to README about generic-only dtype restriction https://claude.ai/code/session_01YYZtPc4pb2E7cJ6TV6JMQK
Member
|
@Planeshifter I think you need to work on your workflow. Not exactly rocket science for a bot to copy-paste an existing package. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Resolves https://github.com/stdlib-js/todo/issues/2775.
Description
This pull request:
@stdlib/ndarray/base/nulls-likepackage which creates a null-filled ndarray having the same shape and data type as a provided ndarray. The implementation follows the existingnans-likepattern:fill( emptyLike( x ), null ).nullsLikein the@stdlib/ndarray/basenamespace (lib/index.jsanddocs/types/index.d.ts).nansLiketo the namespace TypeScript declarations, which was already present inlib/index.jsbut missing fromdocs/types/index.d.ts.Package artifacts created:
lib/main.js— implementationlib/index.js— module entry pointtest/test.js— 62 tests covering happy paths, error paths, identity, mutation guardexamples/index.jsbenchmark/benchmark.jsandbenchmark/benchmark.size.generic.jsdocs/repl.txtdocs/types/index.d.ts— TypeScript declarationsdocs/types/test.ts— TypeScript type testsREADME.mdKey design notes:
"generic"dtype ndarrays. Passing any typed-array dtype (e.g.float64,int32) will causefillto throw aTypeErrorbecausenullcannot be safely cast to those types.declare function nullsLike( x: genericndarray<unknown> ): genericndarray<null>— no generic parameter needed since the output element type is alwaysnull.Related Issues
Questions
No.
Other
No.
Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was written primarily by Claude Code (claude-sonnet-4-6) via the Ralph Loop automated issue-resolution workflow. All implementation choices, test cases, and documentation were reviewed through five parallel adversarial sub-agents (correctness, test quality, convention, security, scope). Findings from those reviews were addressed before opening this PR.
@stdlib-js/reviewers
Generated by Claude Code