@rowsncolumns/fast-formula-parser 6.2.34 → 6.2.35
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +36 -0
- package/dist/esm/index.js.map +1 -1
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -45532,6 +45532,17 @@ class DepParser {
|
|
|
45532
45532
|
if (fnName === "OFFSET") {
|
|
45533
45533
|
return this.handleOffset(args);
|
|
45534
45534
|
}
|
|
45535
|
+
// ADDRESS is pure and is the idiomatic way to build INDIRECT's
|
|
45536
|
+
// target. Folding it here lets handleIndirect register the real
|
|
45537
|
+
// precedent edge (`INDIRECT(ADDRESS(1,3,1,1,"Source"))` →
|
|
45538
|
+
// Source!$C$1), so the calc engine orders the INDIRECT cell after
|
|
45539
|
+
// the chain it reads instead of evaluating it against stale values.
|
|
45540
|
+
if (fnName === "ADDRESS") {
|
|
45541
|
+
const folded = this.foldAddress(args);
|
|
45542
|
+
if (folded !== undefined) {
|
|
45543
|
+
return { value: folded };
|
|
45544
|
+
}
|
|
45545
|
+
}
|
|
45535
45546
|
// Phase 7 LAMBDA: __RNC_LAMBDA__("params", "body") is the
|
|
45536
45547
|
// preprocessor's runtime lambda constructor. The body is a string
|
|
45537
45548
|
// literal that may contain cell refs — recurse the dep parser on
|
|
@@ -45598,6 +45609,31 @@ class DepParser {
|
|
|
45598
45609
|
}
|
|
45599
45610
|
}
|
|
45600
45611
|
|
|
45612
|
+
/**
|
|
45613
|
+
* Evaluate ADDRESS(...) when every argument is a literal scalar.
|
|
45614
|
+
* Returns undefined when an argument is a reference or another
|
|
45615
|
+
* function's placeholder result (the dep parser does not evaluate
|
|
45616
|
+
* those), or when ADDRESS itself would error.
|
|
45617
|
+
*/
|
|
45618
|
+
foldAddress(args = []) {
|
|
45619
|
+
if (!args.length || args.length > 5) return undefined;
|
|
45620
|
+
const scalars = [];
|
|
45621
|
+
for (const arg of args) {
|
|
45622
|
+
if (arg == null) {
|
|
45623
|
+
scalars.push(undefined);
|
|
45624
|
+
continue;
|
|
45625
|
+
}
|
|
45626
|
+
if (typeof arg === "object") return undefined;
|
|
45627
|
+
scalars.push(arg);
|
|
45628
|
+
}
|
|
45629
|
+
try {
|
|
45630
|
+
const address = ReferenceFunctions.ADDRESS(...scalars);
|
|
45631
|
+
return typeof address === "string" ? address : undefined;
|
|
45632
|
+
} catch {
|
|
45633
|
+
return undefined;
|
|
45634
|
+
}
|
|
45635
|
+
}
|
|
45636
|
+
|
|
45601
45637
|
handleIndirect(args = []) {
|
|
45602
45638
|
const refText = this.extractScalar(args[0]);
|
|
45603
45639
|
if (typeof refText !== "string") {
|