Skip to content

feat: add @stdlib/ndarray/base/nulls-like package#12143

Closed
Planeshifter wants to merge 4 commits into
developfrom
claude/vibrant-brahmagupta-8T52k
Closed

feat: add @stdlib/ndarray/base/nulls-like package#12143
Planeshifter wants to merge 4 commits into
developfrom
claude/vibrant-brahmagupta-8T52k

Conversation

@Planeshifter

Copy link
Copy Markdown
Member

Resolves https://github.com/stdlib-js/todo/issues/2775.

Description

What is the purpose of this pull request?

This pull request:

  • Adds a new @stdlib/ndarray/base/nulls-like package which creates a null-filled ndarray having the same shape and data type as a provided ndarray. The implementation follows the existing nans-like pattern: fill( emptyLike( x ), null ).
  • Registers nullsLike in the @stdlib/ndarray/base namespace (lib/index.js and docs/types/index.d.ts).
  • Also adds nansLike to the namespace TypeScript declarations, which was already present in lib/index.js but missing from docs/types/index.d.ts.

Package artifacts created:

  • lib/main.js — implementation
  • lib/index.js — module entry point
  • test/test.js — 62 tests covering happy paths, error paths, identity, mutation guard
  • examples/index.js
  • benchmark/benchmark.js and benchmark/benchmark.size.generic.js
  • docs/repl.txt
  • docs/types/index.d.ts — TypeScript declarations
  • docs/types/test.ts — TypeScript type tests
  • README.md

Key design notes:

  • The function only supports "generic" dtype ndarrays. Passing any typed-array dtype (e.g. float64, int32) will cause fill to throw a TypeError because null cannot be safely cast to those types.
  • The TypeScript signature is declare function nullsLike( x: genericndarray<unknown> ): genericndarray<null> — no generic parameter needed since the output element type is always null.

Related Issues

Does this pull request have any related issues?

Questions

Any questions for reviewers of this pull request?

No.

Other

Any other information relevant to this pull request?

No.

Checklist

Please ensure the following tasks are completed before submitting this pull request.

AI Assistance

When authoring the changes proposed in this PR, did you use any kind of AI assistance?

  • Yes
  • No

If you answered "yes" above, how did you use AI assistance?

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

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

claude added 4 commits May 15, 2026 06:52
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
@kgryte

kgryte commented May 15, 2026

Copy link
Copy Markdown
Member

@Planeshifter I think you need to work on your workflow. Not exactly rocket science for a bot to copy-paste an existing package.

@kgryte kgryte closed this May 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants