From 490ce28645586a8c26db4e677cb433cdd98c5719 Mon Sep 17 00:00:00 2001 From: kingchenc Date: Fri, 22 May 2026 04:15:31 +0200 Subject: [PATCH] B10: document the interleaved layout of Node MACD/Bollinger batch MacdNode.batch and BollingerNode.batch return flat interleaved arrays (3*n and 4*n) but index.d.ts only said Array. Adds /// doc comments describing the layout; napi-rs now propagates them into the generated index.d.ts as JSDoc. --- bindings/node/src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bindings/node/src/lib.rs b/bindings/node/src/lib.rs index 64475761..39ac8a45 100644 --- a/bindings/node/src/lib.rs +++ b/bindings/node/src/lib.rs @@ -135,6 +135,9 @@ impl MacdNode { histogram: o.histogram, }) } + /// Batch over a price array. Returns a flat array of length `3 * n`, + /// interleaved per row as `[macd0, signal0, histogram0, macd1, ...]`. + /// Read column `j` of row `i` as `result[i * 3 + j]`. Warmup rows are `NaN`. #[napi] pub fn batch(&mut self, prices: Vec) -> Vec { let mut out = vec![f64::NAN; prices.len() * 3]; @@ -193,6 +196,9 @@ impl BollingerNode { stddev: o.stddev, }) } + /// Batch over a price array. Returns a flat array of length `4 * n`, + /// interleaved per row as `[upper0, middle0, lower0, stddev0, upper1, ...]`. + /// Read column `j` of row `i` as `result[i * 4 + j]`. Warmup rows are `NaN`. #[napi] pub fn batch(&mut self, prices: Vec) -> Vec { let mut out = vec![f64::NAN; prices.len() * 4];