Skip to content

Commit 612a0a1

Browse files
committed
fix: add log to unpackage lib
1 parent 6b183d2 commit 612a0a1

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/v2/parser/formula.ts

+11-2
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export interface FunctionOps {
2121
[op: string]: (...args: ExpressionThunk[]) => ExpressionValue;
2222
}
2323

24-
const unpackArgs = (f: Delegate) => (expr: ExpressionThunk) => {
24+
const unpackArgs = (f: Delegate, key: string) => (expr: ExpressionThunk) => {
2525
const result = expr();
2626

2727
if (!isArgumentsArray(result)) {
@@ -37,6 +37,15 @@ const unpackArgs = (f: Delegate) => (expr: ExpressionThunk) => {
3737
// eslint-disable-next-line prefer-spread
3838
return f.apply(null, result);
3939
}
40+
// eslint-disable-next-line no-console
41+
console.log("key =", key);
42+
// eslint-disable-next-line no-console
43+
console.log(`fn: unpackArgs (result.length) = ${result.length}`, { result });
44+
// eslint-disable-next-line no-console
45+
console.log(`fn: unpackArgs (f.length) = ${f.length}`, { f });
46+
// eslint-disable-next-line no-console
47+
console.log("fn: unpackArgs (expr)", { expr });
48+
4049
throw new Error(`Incorrect number of arguments. Expected ${f.length}`);
4150
};
4251

@@ -51,7 +60,7 @@ export const formula = function (
5160
// Except for the ARRAY constructor
5261
Object.keys(prefixOps).forEach((key) => {
5362
if (key !== "ARRAY") {
54-
prefixOps[key] = unpackArgs((prefixOps as any)[key]);
63+
prefixOps[key] = unpackArgs((prefixOps as any)[key], key);
5564
}
5665
});
5766

0 commit comments

Comments
 (0)