@lofcz/tinysheet-formula-parser 0.2.13 → 1.0.3
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/index.d.ts +46 -0
- package/dist/index.js +934 -0
- package/package.json +19 -41
- package/es/error.js +0 -45
- package/es/evaluate-by-operator/evaluate-by-operator.js +0 -70
- package/es/evaluate-by-operator/operator/add.js +0 -16
- package/es/evaluate-by-operator/operator/ampersand.js +0 -10
- package/es/evaluate-by-operator/operator/divide.js +0 -21
- package/es/evaluate-by-operator/operator/equal.js +0 -5
- package/es/evaluate-by-operator/operator/formula-function.js +0 -40
- package/es/evaluate-by-operator/operator/greater-than-or-equal.js +0 -5
- package/es/evaluate-by-operator/operator/greater-than.js +0 -5
- package/es/evaluate-by-operator/operator/less-than-or-equal.js +0 -5
- package/es/evaluate-by-operator/operator/less-than.js +0 -5
- package/es/evaluate-by-operator/operator/minus.js +0 -16
- package/es/evaluate-by-operator/operator/multiply.js +0 -16
- package/es/evaluate-by-operator/operator/not-equal.js +0 -5
- package/es/evaluate-by-operator/operator/power.js +0 -11
- package/es/grammar-parser/grammar-parser.jison +0 -230
- package/es/grammar-parser/grammar-parser.js +0 -1522
- package/es/helper/cell.js +0 -117
- package/es/helper/number.js +0 -25
- package/es/helper/string.js +0 -13
- package/es/index.js +0 -5
- package/es/parser.js +0 -306
- package/es/supported-formulas.js +0 -3
- package/lib/error.js +0 -53
- package/lib/evaluate-by-operator/evaluate-by-operator.js +0 -77
- package/lib/evaluate-by-operator/operator/add.js +0 -23
- package/lib/evaluate-by-operator/operator/ampersand.js +0 -17
- package/lib/evaluate-by-operator/operator/divide.js +0 -28
- package/lib/evaluate-by-operator/operator/equal.js +0 -12
- package/lib/evaluate-by-operator/operator/formula-function.js +0 -50
- package/lib/evaluate-by-operator/operator/greater-than-or-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/greater-than.js +0 -12
- package/lib/evaluate-by-operator/operator/less-than-or-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/less-than.js +0 -12
- package/lib/evaluate-by-operator/operator/minus.js +0 -23
- package/lib/evaluate-by-operator/operator/multiply.js +0 -23
- package/lib/evaluate-by-operator/operator/not-equal.js +0 -12
- package/lib/evaluate-by-operator/operator/power.js +0 -18
- package/lib/grammar-parser/grammar-parser.jison +0 -230
- package/lib/grammar-parser/grammar-parser.js +0 -1528
- package/lib/helper/cell.js +0 -128
- package/lib/helper/number.js +0 -32
- package/lib/helper/string.js +0 -19
- package/lib/index.js +0 -114
- package/lib/parser.js +0 -313
- package/lib/supported-formulas.js +0 -11
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
//#region packages/formula-parser/src/index.d.ts
|
|
2
|
+
declare const ERROR: "ERROR";
|
|
3
|
+
declare const ERROR_DIV_ZERO: "DIV/0";
|
|
4
|
+
declare const ERROR_NAME: "NAME";
|
|
5
|
+
declare const ERROR_NOT_AVAILABLE: "N/A";
|
|
6
|
+
declare const ERROR_NULL: "NULL";
|
|
7
|
+
declare const ERROR_NUM: "NUM";
|
|
8
|
+
declare const ERROR_REF: "REF";
|
|
9
|
+
declare const ERROR_VALUE: "VALUE";
|
|
10
|
+
declare const SUPPORTED_FORMULAS: string[];
|
|
11
|
+
declare function error(type: string): string | null;
|
|
12
|
+
type CellCoord = {
|
|
13
|
+
index: number;
|
|
14
|
+
label: string;
|
|
15
|
+
isAbsolute: boolean;
|
|
16
|
+
};
|
|
17
|
+
declare function extractLabel(label: string): [CellCoord, CellCoord, string | null] | [];
|
|
18
|
+
declare function toLabel(row: {
|
|
19
|
+
index: number;
|
|
20
|
+
isAbsolute?: boolean;
|
|
21
|
+
}, column: {
|
|
22
|
+
index: number;
|
|
23
|
+
isAbsolute?: boolean;
|
|
24
|
+
}): string;
|
|
25
|
+
declare function columnIndexToLabel(column: number): string;
|
|
26
|
+
declare function columnLabelToIndex(label: string): number;
|
|
27
|
+
declare function rowIndexToLabel(row: number): string;
|
|
28
|
+
declare function rowLabelToIndex(label: string): number;
|
|
29
|
+
type ParseResult = {
|
|
30
|
+
error: string | null;
|
|
31
|
+
result: unknown;
|
|
32
|
+
};
|
|
33
|
+
declare class Parser {
|
|
34
|
+
constructor();
|
|
35
|
+
parse(expression: string, options?: Record<string, unknown>): ParseResult;
|
|
36
|
+
setVariable(name: string, value: unknown): this;
|
|
37
|
+
getVariable(name: string): unknown;
|
|
38
|
+
setFunction(name: string, fn: (...args: unknown[]) => unknown): this;
|
|
39
|
+
getFunction(name: string): ((...args: unknown[]) => unknown) | undefined;
|
|
40
|
+
on(event: string, listener: (...args: unknown[]) => void): this;
|
|
41
|
+
once(event: string, listener: (...args: unknown[]) => void): this;
|
|
42
|
+
off(event: string, listener?: (...args: unknown[]) => void): this;
|
|
43
|
+
emit(event: string, ...args: unknown[]): this;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { CellCoord, ERROR, ERROR_DIV_ZERO, ERROR_NAME, ERROR_NOT_AVAILABLE, ERROR_NULL, ERROR_NUM, ERROR_REF, ERROR_VALUE, ParseResult, Parser, Parser as default, SUPPORTED_FORMULAS, columnIndexToLabel, columnLabelToIndex, error, extractLabel, rowIndexToLabel, rowLabelToIndex, toLabel };
|