🇬🇧 English | 🇮🇩 Bahasa Indonesia
stdlib-js/stdlib is a standard library for JavaScript and Node.js, providing high-performance mathematical, statistical, and data processing utilities. The @stdlib/stats/incr namespace provides incremental accumulators — stateful functions that efficiently compute statistics over streaming data.
The library already had nanminabs (minimum absolute value ignoring NaN) but was missing its incremental counterpart. Three related issues (#5552, #5637) had been open requesting this feature.
Implemented @stdlib/stats/incr/nanminabs — an incremental accumulator that tracks the minimum absolute value across a stream of numeric inputs while silently skipping NaN values instead of propagating them.
Key design decisions:
- Thin wrapper pattern, consistent with existing accumulators like
@stdlib/stats/incr/nansum - Returns
nullwhen all inputs so far have been NaN (consistent with empty-state behavior) - Signed-zero convention:
-0and+0treated as equal - Full test suite (125 lines), benchmarks (6/6), examples, TypeScript declarations, and REPL docs
This is a revised version of PR #5637, which had review feedback unaddressed on package name, description wording, and format string.
- New package:
@stdlib/stats/incr/nanminabs - Resolves #5552 and supersedes #5637
- 10 files, 738 additions
| File | Additions |
|---|---|
lib/main.js |
+77 |
test/test.js |
+125 |
README.md |
+143 |
benchmark/benchmark.js |
+69 |
docs/repl.txt |
+32 |
docs/types/index.d.ts |
+62 |
docs/types/test.ts |
+61 |
examples/index.js |
+43 |
lib/index.js |
+57 |
package.json |
+69 |
- PR: stdlib-js/stdlib#12246
- Issues: #5552, #5637