@truecalc/core 6.0.0 → 6.1.0
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/README.md +4 -10
- package/package.json +1 -1
- package/truecalc_wasm.d.ts +15 -0
- package/truecalc_wasm.js +1 -1
- package/truecalc_wasm_bg.js +23 -0
- package/truecalc_wasm_bg.wasm +0 -0
package/README.md
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
# @truecalc/core
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@truecalc/core)
|
|
4
|
+
[](https://www.npmjs.com/package/@truecalc/core)
|
|
4
5
|
[](https://crates.io/crates/truecalc-core)
|
|
5
6
|
[](https://docs.rs/truecalc-core)
|
|
6
7
|
[](LICENSE)
|
|
8
|
+
[](https://truecalc.github.io/core/)
|
|
7
9
|
|
|
8
10
|
WebAssembly-powered spreadsheet formula engine for JavaScript/TypeScript.
|
|
9
11
|
|
|
10
|
-
|
|
12
|
+
A comprehensive library of spreadsheet functions (see the live count above). Runs in Node.js, Bun, Deno, and the browser — no server needed. Ground-truth conformance against real Google Sheets. The same engine is also available as a [Rust crate](https://crates.io/crates/truecalc-core) and as an [MCP server](https://crates.io/crates/truecalc-mcp) for AI assistants.
|
|
11
13
|
|
|
12
14
|
```js
|
|
13
15
|
const { evaluate } = require('@truecalc/core');
|
|
@@ -162,15 +164,7 @@ const fns = list_functions();
|
|
|
162
164
|
// ]
|
|
163
165
|
```
|
|
164
166
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
| Category | Functions |
|
|
168
|
-
|------------|-----------|
|
|
169
|
-
| math | SUM, AVERAGE, PRODUCT, ROUND, ROUNDUP, ROUNDDOWN, INT, ABS, SIGN, MOD, POWER, SQRT, LOG, LOG10, LN, EXP, CEILING, FLOOR, RAND, RANDBETWEEN, PI, SIN, COS, TAN, QUOTIENT |
|
|
170
|
-
| logical | IF, AND, OR, NOT, IFERROR, IFNA, IFS, SWITCH, ISNUMBER, ISTEXT, ISERROR, ISBLANK, ISNA |
|
|
171
|
-
| text | LEFT, MID, RIGHT, LEN, LOWER, UPPER, TRIM, CONCATENATE, FIND, SUBSTITUTE, REPLACE, TEXT, VALUE, REPT |
|
|
172
|
-
| financial | PMT, NPV, IRR, PV, FV, RATE, NPER |
|
|
173
|
-
| statistical | COUNT, COUNTA, MAX, MIN, MEDIAN |
|
|
167
|
+
See the full, live function list at [truecalc.github.io/core](https://truecalc.github.io/core/).
|
|
174
168
|
|
|
175
169
|
## Documentation
|
|
176
170
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@truecalc/core",
|
|
3
3
|
"type": "module",
|
|
4
4
|
"description": "Spreadsheet formula engine for the browser — Google Sheets–compatible formula evaluator compiled to WebAssembly",
|
|
5
|
-
"version": "6.
|
|
5
|
+
"version": "6.1.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"repository": {
|
|
8
8
|
"type": "git",
|
package/truecalc_wasm.d.ts
CHANGED
|
@@ -34,6 +34,11 @@ export interface FunctionInfo {
|
|
|
34
34
|
description: string;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
export interface RenameSheetRefsResult {
|
|
38
|
+
formula?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
}
|
|
41
|
+
|
|
37
42
|
export interface TranslateResult {
|
|
38
43
|
formula?: string;
|
|
39
44
|
error?: string;
|
|
@@ -83,6 +88,16 @@ export function evaluate(formula: string, variables: any): EvalResult;
|
|
|
83
88
|
*/
|
|
84
89
|
export function list_functions(): FunctionInfo[];
|
|
85
90
|
|
|
91
|
+
/**
|
|
92
|
+
* Rewrite the sheet qualifier of every cell/range reference in `formula`
|
|
93
|
+
* that points at `old` to point at `new` instead — the sheet-rename
|
|
94
|
+
* reference-rewrite transform. Sheet-name matching is case-insensitive.
|
|
95
|
+
* Requoting is handled automatically. Unqualified refs, refs to other
|
|
96
|
+
* sheets, string literals, function names, and defined names are left
|
|
97
|
+
* untouched; no-op if `formula` has no `old`-qualified refs.
|
|
98
|
+
*/
|
|
99
|
+
export function rename_sheet_refs(formula: string, old: string, _new: string): RenameSheetRefsResult;
|
|
100
|
+
|
|
86
101
|
/**
|
|
87
102
|
* Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
|
|
88
103
|
* — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
|
package/truecalc_wasm.js
CHANGED
|
@@ -5,5 +5,5 @@ import { __wbg_set_wasm } from "./truecalc_wasm_bg.js";
|
|
|
5
5
|
__wbg_set_wasm(wasm);
|
|
6
6
|
|
|
7
7
|
export {
|
|
8
|
-
Engine, createEngine, evaluate, list_functions, translate_formula, validate
|
|
8
|
+
Engine, createEngine, evaluate, list_functions, rename_sheet_refs, translate_formula, validate
|
|
9
9
|
} from "./truecalc_wasm_bg.js";
|
package/truecalc_wasm_bg.js
CHANGED
|
@@ -98,6 +98,29 @@ export function list_functions() {
|
|
|
98
98
|
}
|
|
99
99
|
}
|
|
100
100
|
|
|
101
|
+
/**
|
|
102
|
+
* Rewrite the sheet qualifier of every cell/range reference in `formula`
|
|
103
|
+
* that points at `old` to point at `new` instead — the sheet-rename
|
|
104
|
+
* reference-rewrite transform. Sheet-name matching is case-insensitive.
|
|
105
|
+
* Requoting is handled automatically. Unqualified refs, refs to other
|
|
106
|
+
* sheets, string literals, function names, and defined names are left
|
|
107
|
+
* untouched; no-op if `formula` has no `old`-qualified refs.
|
|
108
|
+
* @param {string} formula
|
|
109
|
+
* @param {string} old
|
|
110
|
+
* @param {string} _new
|
|
111
|
+
* @returns {RenameSheetRefsResult}
|
|
112
|
+
*/
|
|
113
|
+
export function rename_sheet_refs(formula, old, _new) {
|
|
114
|
+
const ptr0 = passStringToWasm0(formula, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
115
|
+
const len0 = WASM_VECTOR_LEN;
|
|
116
|
+
const ptr1 = passStringToWasm0(old, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
117
|
+
const len1 = WASM_VECTOR_LEN;
|
|
118
|
+
const ptr2 = passStringToWasm0(_new, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
119
|
+
const len2 = WASM_VECTOR_LEN;
|
|
120
|
+
const ret = wasm.rename_sheet_refs(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
121
|
+
return takeObject(ret);
|
|
122
|
+
}
|
|
123
|
+
|
|
101
124
|
/**
|
|
102
125
|
* Shift every relative cell/range reference in `formula` by `(d_row, d_col)`
|
|
103
126
|
* — the fill / copy-paste reference-adjustment transform. `$`-absolute axes
|
package/truecalc_wasm_bg.wasm
CHANGED
|
Binary file
|