@shbernal/ts-xlsx 3.2.0 → 3.2.1
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/core/formula.d.ts +2 -2
- package/dist/core/formula.js +4 -3
- package/package.json +1 -1
package/dist/core/formula.d.ts
CHANGED
|
@@ -50,8 +50,8 @@ export declare function mangleParams(formula: string): string;
|
|
|
50
50
|
* LET or LAMBDA parameter spelled like a function already carries `_xlpm.`.
|
|
51
51
|
*
|
|
52
52
|
* A name is not a value where it names a sheet (`SUM!A1`, `SUM:Other!A1`) or a table (`Rate[Amount]`),
|
|
53
|
-
* where a sheet or workbook qualifies it (`S1!SUM`),
|
|
54
|
-
* function too.
|
|
53
|
+
* where a sheet or workbook qualifies it (`S1!SUM`), where it is the column of a reference (`$T$1`,
|
|
54
|
+
* `T:T`), or inside an error literal: the `N` of `#N/A` is a function too.
|
|
55
55
|
*/
|
|
56
56
|
export declare function mangleFunctionValues(formula: string, namesInScope: ReadonlySet<string>): string;
|
|
57
57
|
/**
|
package/dist/core/formula.js
CHANGED
|
@@ -145,7 +145,8 @@ export function mangleParams(formula) {
|
|
|
145
145
|
i = k + 1;
|
|
146
146
|
continue;
|
|
147
147
|
}
|
|
148
|
-
const
|
|
148
|
+
const anchored = formula[i - 1] === '$' || formula[nameEnd] === '$';
|
|
149
|
+
const spelling = anchored ? undefined : declared(name);
|
|
149
150
|
out += spelling === undefined ? name : `${XLPM}${spelling}`;
|
|
150
151
|
i = nameEnd;
|
|
151
152
|
}
|
|
@@ -173,8 +174,8 @@ export function mangleFunctionValues(formula, namesInScope) {
|
|
|
173
174
|
}
|
|
174
175
|
return out;
|
|
175
176
|
}
|
|
176
|
-
const QUALIFIES_NAME = /[A-Za-z0-9_
|
|
177
|
-
const NAMES_A_CONTAINER = /[
|
|
177
|
+
const QUALIFIES_NAME = /[A-Za-z0-9_.$:!#\]]/;
|
|
178
|
+
const NAMES_A_CONTAINER = /[!:$[]/;
|
|
178
179
|
function isFunctionValue(formula, start, end, namesInScope) {
|
|
179
180
|
const name = formula.slice(start, end).toUpperCase();
|
|
180
181
|
if (!FUNCTION_VALUE_NAMES.has(name) || namesInScope.has(name))
|