@gridsheet/core 3.0.0-rc.8
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 +17 -0
- package/dist/constants.d.ts +21 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +28 -0
- package/dist/constants.js.map +1 -0
- package/dist/formula/evaluator.d.ts +134 -0
- package/dist/formula/evaluator.d.ts.map +1 -0
- package/dist/formula/evaluator.js +585 -0
- package/dist/formula/evaluator.js.map +1 -0
- package/dist/formula/formula-error.d.ts +10 -0
- package/dist/formula/formula-error.d.ts.map +1 -0
- package/dist/formula/formula-error.js +15 -0
- package/dist/formula/formula-error.js.map +1 -0
- package/dist/formula/functions/__async.d.ts +67 -0
- package/dist/formula/functions/__async.d.ts.map +1 -0
- package/dist/formula/functions/__async.js +70 -0
- package/dist/formula/functions/__async.js.map +1 -0
- package/dist/formula/functions/__base.d.ts +112 -0
- package/dist/formula/functions/__base.d.ts.map +1 -0
- package/dist/formula/functions/__base.js +265 -0
- package/dist/formula/functions/__base.js.map +1 -0
- package/dist/formula/functions/__utils.d.ts +28 -0
- package/dist/formula/functions/__utils.d.ts.map +1 -0
- package/dist/formula/functions/__utils.js +179 -0
- package/dist/formula/functions/__utils.js.map +1 -0
- package/dist/formula/functions/abs.d.ts +9 -0
- package/dist/formula/functions/abs.d.ts.map +1 -0
- package/dist/formula/functions/abs.js +15 -0
- package/dist/formula/functions/abs.js.map +1 -0
- package/dist/formula/functions/add.d.ts +10 -0
- package/dist/formula/functions/add.d.ts.map +1 -0
- package/dist/formula/functions/add.js +37 -0
- package/dist/formula/functions/add.js.map +1 -0
- package/dist/formula/functions/and.d.ts +9 -0
- package/dist/formula/functions/and.d.ts.map +1 -0
- package/dist/formula/functions/and.js +23 -0
- package/dist/formula/functions/and.js.map +1 -0
- package/dist/formula/functions/arrayformula.d.ts +12 -0
- package/dist/formula/functions/arrayformula.d.ts.map +1 -0
- package/dist/formula/functions/arrayformula.js +24 -0
- package/dist/formula/functions/arrayformula.js.map +1 -0
- package/dist/formula/functions/average.d.ts +9 -0
- package/dist/formula/functions/average.d.ts.map +1 -0
- package/dist/formula/functions/average.js +40 -0
- package/dist/formula/functions/average.js.map +1 -0
- package/dist/formula/functions/concat.d.ts +9 -0
- package/dist/formula/functions/concat.d.ts.map +1 -0
- package/dist/formula/functions/concat.js +27 -0
- package/dist/formula/functions/concat.js.map +1 -0
- package/dist/formula/functions/count.d.ts +9 -0
- package/dist/formula/functions/count.d.ts.map +1 -0
- package/dist/formula/functions/count.js +32 -0
- package/dist/formula/functions/count.js.map +1 -0
- package/dist/formula/functions/counta.d.ts +9 -0
- package/dist/formula/functions/counta.d.ts.map +1 -0
- package/dist/formula/functions/counta.js +32 -0
- package/dist/formula/functions/counta.js.map +1 -0
- package/dist/formula/functions/divide.d.ts +10 -0
- package/dist/formula/functions/divide.d.ts.map +1 -0
- package/dist/formula/functions/divide.js +34 -0
- package/dist/formula/functions/divide.js.map +1 -0
- package/dist/formula/functions/eq.d.ts +9 -0
- package/dist/formula/functions/eq.d.ts.map +1 -0
- package/dist/formula/functions/eq.js +19 -0
- package/dist/formula/functions/eq.js.map +1 -0
- package/dist/formula/functions/gt.d.ts +9 -0
- package/dist/formula/functions/gt.d.ts.map +1 -0
- package/dist/formula/functions/gt.js +19 -0
- package/dist/formula/functions/gt.js.map +1 -0
- package/dist/formula/functions/gte.d.ts +9 -0
- package/dist/formula/functions/gte.d.ts.map +1 -0
- package/dist/formula/functions/gte.js +19 -0
- package/dist/formula/functions/gte.js.map +1 -0
- package/dist/formula/functions/if.d.ts +9 -0
- package/dist/formula/functions/if.d.ts.map +1 -0
- package/dist/formula/functions/if.js +29 -0
- package/dist/formula/functions/if.js.map +1 -0
- package/dist/formula/functions/iferror.d.ts +10 -0
- package/dist/formula/functions/iferror.d.ts.map +1 -0
- package/dist/formula/functions/iferror.js +28 -0
- package/dist/formula/functions/iferror.js.map +1 -0
- package/dist/formula/functions/len.d.ts +9 -0
- package/dist/formula/functions/len.d.ts.map +1 -0
- package/dist/formula/functions/len.js +21 -0
- package/dist/formula/functions/len.js.map +1 -0
- package/dist/formula/functions/lt.d.ts +9 -0
- package/dist/formula/functions/lt.d.ts.map +1 -0
- package/dist/formula/functions/lt.js +19 -0
- package/dist/formula/functions/lt.js.map +1 -0
- package/dist/formula/functions/lte.d.ts +9 -0
- package/dist/formula/functions/lte.d.ts.map +1 -0
- package/dist/formula/functions/lte.js +19 -0
- package/dist/formula/functions/lte.js.map +1 -0
- package/dist/formula/functions/max.d.ts +9 -0
- package/dist/formula/functions/max.d.ts.map +1 -0
- package/dist/formula/functions/max.js +37 -0
- package/dist/formula/functions/max.js.map +1 -0
- package/dist/formula/functions/min.d.ts +9 -0
- package/dist/formula/functions/min.d.ts.map +1 -0
- package/dist/formula/functions/min.js +37 -0
- package/dist/formula/functions/min.js.map +1 -0
- package/dist/formula/functions/minus.d.ts +10 -0
- package/dist/formula/functions/minus.d.ts.map +1 -0
- package/dist/formula/functions/minus.js +41 -0
- package/dist/formula/functions/minus.js.map +1 -0
- package/dist/formula/functions/multiply.d.ts +9 -0
- package/dist/formula/functions/multiply.d.ts.map +1 -0
- package/dist/formula/functions/multiply.js +19 -0
- package/dist/formula/functions/multiply.js.map +1 -0
- package/dist/formula/functions/ne.d.ts +9 -0
- package/dist/formula/functions/ne.d.ts.map +1 -0
- package/dist/formula/functions/ne.js +19 -0
- package/dist/formula/functions/ne.js.map +1 -0
- package/dist/formula/functions/not.d.ts +9 -0
- package/dist/formula/functions/not.d.ts.map +1 -0
- package/dist/formula/functions/not.js +22 -0
- package/dist/formula/functions/not.js.map +1 -0
- package/dist/formula/functions/now.d.ts +9 -0
- package/dist/formula/functions/now.d.ts.map +1 -0
- package/dist/formula/functions/now.js +14 -0
- package/dist/formula/functions/now.js.map +1 -0
- package/dist/formula/functions/or.d.ts +9 -0
- package/dist/formula/functions/or.d.ts.map +1 -0
- package/dist/formula/functions/or.js +23 -0
- package/dist/formula/functions/or.js.map +1 -0
- package/dist/formula/functions/power.d.ts +9 -0
- package/dist/formula/functions/power.d.ts.map +1 -0
- package/dist/formula/functions/power.js +18 -0
- package/dist/formula/functions/power.js.map +1 -0
- package/dist/formula/functions/sum.d.ts +9 -0
- package/dist/formula/functions/sum.d.ts.map +1 -0
- package/dist/formula/functions/sum.js +34 -0
- package/dist/formula/functions/sum.js.map +1 -0
- package/dist/formula/functions/uminus.d.ts +9 -0
- package/dist/formula/functions/uminus.d.ts.map +1 -0
- package/dist/formula/functions/uminus.js +17 -0
- package/dist/formula/functions/uminus.js.map +1 -0
- package/dist/formula/mapping.d.ts +11 -0
- package/dist/formula/mapping.d.ts.map +1 -0
- package/dist/formula/mapping.js +82 -0
- package/dist/formula/mapping.js.map +1 -0
- package/dist/formula/solver.d.ts +39 -0
- package/dist/formula/solver.d.ts.map +1 -0
- package/dist/formula/solver.js +71 -0
- package/dist/formula/solver.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +74 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/autofill.d.ts +22 -0
- package/dist/lib/autofill.d.ts.map +1 -0
- package/dist/lib/autofill.js +276 -0
- package/dist/lib/autofill.js.map +1 -0
- package/dist/lib/book.d.ts +131 -0
- package/dist/lib/book.d.ts.map +1 -0
- package/dist/lib/book.js +53 -0
- package/dist/lib/book.js.map +1 -0
- package/dist/lib/cell.d.ts +17 -0
- package/dist/lib/cell.d.ts.map +1 -0
- package/dist/lib/cell.js +17 -0
- package/dist/lib/cell.js.map +1 -0
- package/dist/lib/coords.d.ts +22 -0
- package/dist/lib/coords.d.ts.map +1 -0
- package/dist/lib/coords.js +73 -0
- package/dist/lib/coords.js.map +1 -0
- package/dist/lib/date.d.ts +2 -0
- package/dist/lib/date.d.ts.map +1 -0
- package/dist/lib/date.js +91 -0
- package/dist/lib/date.js.map +1 -0
- package/dist/lib/dom.d.ts +7 -0
- package/dist/lib/dom.d.ts.map +1 -0
- package/dist/lib/dom.js +28 -0
- package/dist/lib/dom.js.map +1 -0
- package/dist/lib/filter.d.ts +7 -0
- package/dist/lib/filter.d.ts.map +1 -0
- package/dist/lib/filter.js +122 -0
- package/dist/lib/filter.js.map +1 -0
- package/dist/lib/input.d.ts +28 -0
- package/dist/lib/input.d.ts.map +1 -0
- package/dist/lib/input.js +73 -0
- package/dist/lib/input.js.map +1 -0
- package/dist/lib/label.d.ts +4 -0
- package/dist/lib/label.d.ts.map +1 -0
- package/dist/lib/label.js +10 -0
- package/dist/lib/label.js.map +1 -0
- package/dist/lib/operation.d.ts +31 -0
- package/dist/lib/operation.d.ts.map +1 -0
- package/dist/lib/operation.js +36 -0
- package/dist/lib/operation.js.map +1 -0
- package/dist/lib/palette.d.ts +2 -0
- package/dist/lib/palette.d.ts.map +1 -0
- package/dist/lib/palette.js +26 -0
- package/dist/lib/palette.js.map +1 -0
- package/dist/lib/popup.d.ts +24 -0
- package/dist/lib/popup.d.ts.map +1 -0
- package/dist/lib/popup.js +21 -0
- package/dist/lib/popup.js.map +1 -0
- package/dist/lib/reference.d.ts +19 -0
- package/dist/lib/reference.d.ts.map +1 -0
- package/dist/lib/reference.js +40 -0
- package/dist/lib/reference.js.map +1 -0
- package/dist/lib/sheet.d.ts +512 -0
- package/dist/lib/sheet.d.ts.map +1 -0
- package/dist/lib/sheet.js +1530 -0
- package/dist/lib/sheet.js.map +1 -0
- package/dist/lib/sheet_utils.d.ts +55 -0
- package/dist/lib/sheet_utils.d.ts.map +1 -0
- package/dist/lib/sheet_utils.js +125 -0
- package/dist/lib/sheet_utils.js.map +1 -0
- package/dist/lib/spatial.d.ts +79 -0
- package/dist/lib/spatial.d.ts.map +1 -0
- package/dist/lib/spatial.js +227 -0
- package/dist/lib/spatial.js.map +1 -0
- package/dist/lib/time.d.ts +29 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +113 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/virtualization.d.ts +22 -0
- package/dist/lib/virtualization.d.ts.map +1 -0
- package/dist/lib/virtualization.js +91 -0
- package/dist/lib/virtualization.js.map +1 -0
- package/dist/policy/core.d.ts +161 -0
- package/dist/policy/core.d.ts.map +1 -0
- package/dist/policy/core.js +248 -0
- package/dist/policy/core.js.map +1 -0
- package/dist/policy/thousand_separator.d.ts +4 -0
- package/dist/policy/thousand_separator.d.ts.map +1 -0
- package/dist/policy/thousand_separator.js +13 -0
- package/dist/policy/thousand_separator.js.map +1 -0
- package/dist/sentinels.d.ts +40 -0
- package/dist/sentinels.d.ts.map +1 -0
- package/dist/sentinels.js +41 -0
- package/dist/sentinels.js.map +1 -0
- package/dist/styles/embedder.d.ts +2 -0
- package/dist/styles/embedder.d.ts.map +1 -0
- package/dist/styles/embedder.js +11 -0
- package/dist/styles/embedder.js.map +1 -0
- package/dist/styles/minified.d.ts +3 -0
- package/dist/styles/minified.d.ts.map +1 -0
- package/dist/styles/minified.js +6 -0
- package/dist/styles/minified.js.map +1 -0
- package/dist/types.d.ts +310 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +5 -0
- package/dist/utils.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add.js","sources":["../../../src/formula/functions/add.ts"],"sourcesContent":["import dayjs from 'dayjs';\n\nimport { FormulaError } from '../formula-error';\nimport { BaseFunction, type FunctionCategory, type FunctionArgumentDefinition } from './__base';\nimport { ensureNumber } from './__utils';\nimport { Time } from '../../lib/time';\nimport { SECONDS_IN_DAY } from '../../constants';\n\nconst description = `Returns the sum of two numbers.\nThis is the same as the '+' operator.`;\n\nexport class AddFunction extends BaseFunction {\n example = 'ADD(2, 3)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n { name: 'value1', description: 'First additive.', acceptedTypes: ['number', 'date', 'time'] },\n { name: 'value2', description: 'Second additive.', acceptedTypes: ['number', 'date', 'time'] },\n ];\n category: FunctionCategory = 'math';\n\n protected main(v1: number | Date | Time, v2: number | Date | Time) {\n if (typeof v1 === 'number' && typeof v2 === 'number') {\n return v1 + v2;\n }\n if (v1 instanceof Date && Time.is(v2)) {\n return Time.ensure(v2).add(v1);\n }\n if (Time.is(v1) && v2 instanceof Date) {\n return Time.ensure(v1).add(v2);\n }\n if (v1 instanceof Date && typeof v2 === 'number') {\n return dayjs(v1)\n .add(v2 * SECONDS_IN_DAY, 'second')\n .toDate();\n }\n if (typeof v1 === 'number' && v2 instanceof Date) {\n return dayjs(v2)\n .add(v1 * SECONDS_IN_DAY, 'second')\n .toDate();\n }\n try {\n return ensureNumber(v1, { alternative: 0 }) + ensureNumber(v2, { alternative: 0 });\n } catch (e) {\n throw new FormulaError('#VALUE!', 'Mismatched types for augend or addend.');\n }\n }\n}\n"],"names":["description","AddFunction","BaseFunction","v1","v2","Time","dayjs","SECONDS_IN_DAY","ensureNumber","FormulaError"],"mappings":";;;;;;AAQA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAoBC,EAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,aACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC,EAAE,MAAM,UAAU,aAAa,mBAAmB,eAAe,CAAC,UAAU,QAAQ,MAAM,EAAE;AAAA,MAC5F,EAAE,MAAM,UAAU,aAAa,oBAAoB,eAAe,CAAC,UAAU,QAAQ,MAAM,EAAE;AAAA,IAC/F,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAA0BC,GAA0B;AACjE,QAAI,OAAOD,KAAO,YAAY,OAAOC,KAAO;AAC1C,aAAOD,IAAKC;AAEd,QAAID,aAAc,QAAQE,EAAK,GAAGD,CAAE;AAClC,aAAOC,EAAK,OAAOD,CAAE,EAAE,IAAID,CAAE;AAE/B,QAAIE,EAAK,GAAGF,CAAE,KAAKC,aAAc;AAC/B,aAAOC,EAAK,OAAOF,CAAE,EAAE,IAAIC,CAAE;AAE/B,QAAID,aAAc,QAAQ,OAAOC,KAAO;AAC/B,aAAAE,EAAMH,CAAE,EACZ,IAAIC,IAAKG,GAAgB,QAAQ,EACjC,OAAO;AAEZ,QAAI,OAAOJ,KAAO,YAAYC,aAAc;AACnC,aAAAE,EAAMF,CAAE,EACZ,IAAID,IAAKI,GAAgB,QAAQ,EACjC,OAAO;AAER,QAAA;AACF,aAAOC,EAAaL,GAAI,EAAE,aAAa,EAAE,CAAC,IAAIK,EAAaJ,GAAI,EAAE,aAAa,EAAA,CAAG;AAAA,YACvE;AACJ,YAAA,IAAIK,EAAa,WAAW,wCAAwC;AAAA,IAAA;AAAA,EAC5E;AAEJ;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class AndFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=and.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"and.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/and.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAqB;IAC5B,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAOhC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IAEvC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE;CAGhC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseFunction as t } from "./__base.js";
|
|
2
|
+
import { ensureBoolean as i } from "./__utils.js";
|
|
3
|
+
const n = `Returns TRUE if all arguments are logically TRUE.
|
|
4
|
+
Returns FALSE if any argument is logically FALSE.`;
|
|
5
|
+
class l extends t {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = "AND(A1=1, A2=2)", this.description = n, this.defs = [
|
|
8
|
+
{
|
|
9
|
+
name: "expression",
|
|
10
|
+
description: "Logical expressions to evaluate.",
|
|
11
|
+
acceptedTypes: ["boolean", "number"],
|
|
12
|
+
variadic: !0
|
|
13
|
+
}
|
|
14
|
+
], this.category = "logical";
|
|
15
|
+
}
|
|
16
|
+
main(...r) {
|
|
17
|
+
return r.map((e) => i(e)).reduce((e, s) => e && s);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export {
|
|
21
|
+
l as AndFunction
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=and.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"and.js","sources":["../../../src/formula/functions/and.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { ensureBoolean } from './__utils';\n\nconst description = `Returns TRUE if all arguments are logically TRUE.\nReturns FALSE if any argument is logically FALSE.`;\n\nexport class AndFunction extends BaseFunction {\n example = 'AND(A1=1, A2=2)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'expression',\n description: 'Logical expressions to evaluate.',\n acceptedTypes: ['boolean', 'number'],\n variadic: true,\n },\n ];\n category: FunctionCategory = 'logical';\n\n protected main(...values: any[]) {\n return values.map((v) => ensureBoolean(v)).reduce((a, b) => a && b);\n }\n}\n"],"names":["description","AndFunction","BaseFunction","values","v","ensureBoolean","a","b"],"mappings":";;AAGA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAoBC,EAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,mBACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,WAAW,QAAQ;AAAA,QACnC,UAAU;AAAA,MAAA;AAAA,IAEd,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,QAAQG,GAAe;AAC/B,WAAOA,EAAO,IAAI,CAACC,MAAMC,EAAcD,CAAC,CAAC,EAAE,OAAO,CAACE,GAAGC,MAAMD,KAAKC,CAAC;AAAA,EAAA;AAEtE;"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Spilling } from '../../sentinels';
|
|
2
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
3
|
+
export declare class ArrayformulaFunction extends BaseFunction {
|
|
4
|
+
autoSpilling: boolean;
|
|
5
|
+
example: string;
|
|
6
|
+
description: string;
|
|
7
|
+
defs: FunctionArgumentDefinition[];
|
|
8
|
+
category: FunctionCategory;
|
|
9
|
+
protected broadcastDisabled: boolean;
|
|
10
|
+
protected main(value: any): any[] | Spilling;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=arrayformula.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayformula.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/arrayformula.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAKtF,qBAAa,oBAAqB,SAAQ,YAAY;IACpD,YAAY,UAAQ;IACpB,OAAO,SAAmC;IAC1C,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAOhC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IACvC,SAAS,CAAC,iBAAiB,UAAQ;IAEnC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG;CAY1B"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Sheet as r } from "../../lib/sheet.js";
|
|
2
|
+
import { Spilling as t } from "../../sentinels.js";
|
|
3
|
+
import { BaseFunction as i } from "./__base.js";
|
|
4
|
+
const a = `Enables the display of values returned from an array formula into multiple rows and/or columns.
|
|
5
|
+
If the argument is already a Spilling, it is returned as-is. If it is a Sheet (range reference), the field matrix is extracted and wrapped in a Spilling. Otherwise the value is wrapped as a single-element Spilling.`;
|
|
6
|
+
class p extends i {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments), this.autoSpilling = !0, this.example = "ARRAYFORMULA(A1:A10 * B1:B10)", this.description = a, this.defs = [
|
|
9
|
+
{
|
|
10
|
+
name: "value",
|
|
11
|
+
description: "The array expression or value to evaluate.",
|
|
12
|
+
takesMatrix: !0,
|
|
13
|
+
acceptedTypes: ["matrix", "any"]
|
|
14
|
+
}
|
|
15
|
+
], this.category = "logical", this.broadcastDisabled = !0;
|
|
16
|
+
}
|
|
17
|
+
main(e) {
|
|
18
|
+
return t.is(e) ? e : e instanceof r ? e._toValueMatrix() : Array.isArray(e) ? e : [[e]];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
p as ArrayformulaFunction
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=arrayformula.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"arrayformula.js","sources":["../../../src/formula/functions/arrayformula.ts"],"sourcesContent":["import { Sheet } from '../../lib/sheet';\nimport { Spilling } from '../../sentinels';\nimport { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\n\nconst description = `Enables the display of values returned from an array formula into multiple rows and/or columns.\nIf the argument is already a Spilling, it is returned as-is. If it is a Sheet (range reference), the field matrix is extracted and wrapped in a Spilling. Otherwise the value is wrapped as a single-element Spilling.`;\n\nexport class ArrayformulaFunction extends BaseFunction {\n autoSpilling = true;\n example = 'ARRAYFORMULA(A1:A10 * B1:B10)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value',\n description: 'The array expression or value to evaluate.',\n takesMatrix: true,\n acceptedTypes: ['matrix', 'any'],\n },\n ];\n category: FunctionCategory = 'logical';\n protected broadcastDisabled = true;\n\n protected main(value: any) {\n if (Spilling.is(value)) {\n return value;\n }\n if (value instanceof Sheet) {\n return value._toValueMatrix();\n }\n if (Array.isArray(value)) {\n return value;\n }\n return [[value]];\n }\n}\n"],"names":["description","ArrayformulaFunction","BaseFunction","value","Spilling","Sheet"],"mappings":";;;AAIA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAA6BC,EAAa;AAAA,EAAhD,cAAA;AAAA,UAAA,GAAA,SAAA,GACU,KAAA,eAAA,IACL,KAAA,UAAA,iCACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,KAAK;AAAA,MAAA;AAAA,IAEnC,GAC6B,KAAA,WAAA,WAC7B,KAAU,oBAAoB;AAAA,EAAA;AAAA,EAEpB,KAAKG,GAAY;AACrB,WAAAC,EAAS,GAAGD,CAAK,IACZA,IAELA,aAAiBE,IACZF,EAAM,eAAe,IAE1B,MAAM,QAAQA,CAAK,IACdA,IAEF,CAAC,CAACA,CAAK,CAAC;AAAA,EAAA;AAEnB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class AverageFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=average.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"average.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/average.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAY,MAAM,UAAU,CAAC;AAKhG,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAA2B;IAClC,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAQhC;IACF,QAAQ,EAAE,gBAAgB,CAAgB;IAE1C,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE;CA2BhC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { FormulaError as o } from "../formula-error.js";
|
|
2
|
+
import { BaseFunction as a, isMatrix as n } from "./__base.js";
|
|
3
|
+
import { eachMatrix as u, ensureNumber as c } from "./__utils.js";
|
|
4
|
+
const m = "Returns the average of a series of numbers or cells.";
|
|
5
|
+
class l extends a {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = "AVERAGE(A2:A100, 101)", this.description = m, this.defs = [
|
|
8
|
+
{
|
|
9
|
+
name: "value",
|
|
10
|
+
description: "Numbers or ranges to average.",
|
|
11
|
+
takesMatrix: !0,
|
|
12
|
+
acceptedTypes: ["number", "matrix"],
|
|
13
|
+
variadic: !0
|
|
14
|
+
}
|
|
15
|
+
], this.category = "statistics";
|
|
16
|
+
}
|
|
17
|
+
main(...i) {
|
|
18
|
+
let t = 0, e = 0;
|
|
19
|
+
if (i.forEach((s) => {
|
|
20
|
+
if (n(s))
|
|
21
|
+
u(
|
|
22
|
+
s,
|
|
23
|
+
(r) => {
|
|
24
|
+
typeof r == "number" && (t += r, e++);
|
|
25
|
+
},
|
|
26
|
+
this.at
|
|
27
|
+
);
|
|
28
|
+
else {
|
|
29
|
+
const r = c(s);
|
|
30
|
+
t += r, e++;
|
|
31
|
+
}
|
|
32
|
+
}), e === 0)
|
|
33
|
+
throw new o("#DIV/0!", "Evaluation of function AVERAGE caused a divide by zero error.");
|
|
34
|
+
return t / e;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export {
|
|
38
|
+
l as AverageFunction
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=average.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"average.js","sources":["../../../src/formula/functions/average.ts"],"sourcesContent":["import { FormulaError } from '../formula-error';\nimport { BaseFunction, FunctionCategory, FunctionArgumentDefinition, isMatrix } from './__base';\nimport { ensureNumber, eachMatrix } from './__utils';\n\nconst description = `Returns the average of a series of numbers or cells.`;\n\nexport class AverageFunction extends BaseFunction {\n example = 'AVERAGE(A2:A100, 101)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value',\n description: 'Numbers or ranges to average.',\n takesMatrix: true,\n acceptedTypes: ['number', 'matrix'],\n variadic: true,\n },\n ];\n category: FunctionCategory = 'statistics';\n\n protected main(...values: any[]) {\n let sum = 0;\n let count = 0;\n values.forEach((val) => {\n if (isMatrix(val)) {\n eachMatrix(\n val,\n (v) => {\n if (typeof v === 'number') {\n sum += v;\n count++;\n }\n },\n this.at,\n );\n } else {\n const num = ensureNumber(val);\n sum += num;\n count++;\n }\n });\n\n if (count === 0) {\n throw new FormulaError('#DIV/0!', 'Evaluation of function AVERAGE caused a divide by zero error.');\n }\n return sum / count;\n }\n}\n"],"names":["description","AverageFunction","BaseFunction","values","sum","count","val","isMatrix","eachMatrix","v","num","ensureNumber","FormulaError"],"mappings":";;;AAIA,MAAMA,IAAc;AAEb,MAAMC,UAAwBC,EAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,yBACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,QAAQ;AAAA,QAClC,UAAU;AAAA,MAAA;AAAA,IAEd,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,QAAQG,GAAe;AAC/B,QAAIC,IAAM,GACNC,IAAQ;AAoBZ,QAnBOF,EAAA,QAAQ,CAACG,MAAQ;AAClB,UAAAC,EAASD,CAAG;AACd,QAAAE;AAAA,UACEF;AAAA,UACA,CAACG,MAAM;AACD,YAAA,OAAOA,KAAM,aACRL,KAAAK,GACPJ;AAAA,UAEJ;AAAA,UACA,KAAK;AAAA,QACP;AAAA,WACK;AACC,cAAAK,IAAMC,EAAaL,CAAG;AACrB,QAAAF,KAAAM,GACPL;AAAA,MAAA;AAAA,IACF,CACD,GAEGA,MAAU;AACN,YAAA,IAAIO,EAAa,WAAW,+DAA+D;AAEnG,WAAOR,IAAMC;AAAA,EAAA;AAEjB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class ConcatFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): string;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=concat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/concat.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,SAA8B;IACrC,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAWhC;IACF,QAAQ,EAAE,gBAAgB,CAAU;IAEpC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;CAGhC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseFunction as o } from "./__base.js";
|
|
2
|
+
import { ensureString as e } from "./__utils.js";
|
|
3
|
+
const a = `Returns the concatenation of two values.
|
|
4
|
+
This is the same as the '&' operator.`;
|
|
5
|
+
class c extends o {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = 'CONCAT("Hello", "World")', this.description = a, this.defs = [
|
|
8
|
+
{
|
|
9
|
+
name: "value1",
|
|
10
|
+
description: "A value to be concatenated with value2.",
|
|
11
|
+
acceptedTypes: ["string", "number", "boolean"]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "value2",
|
|
15
|
+
description: "A value to be concatenated with value1",
|
|
16
|
+
acceptedTypes: ["string", "number", "boolean"]
|
|
17
|
+
}
|
|
18
|
+
], this.category = "text";
|
|
19
|
+
}
|
|
20
|
+
main(t, n) {
|
|
21
|
+
return e(t) + e(n);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
export {
|
|
25
|
+
c as ConcatFunction
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=concat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concat.js","sources":["../../../src/formula/functions/concat.ts"],"sourcesContent":["import { FormulaError } from '../formula-error';\nimport { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { ensureString } from './__utils';\n\nconst description = `Returns the concatenation of two values.\nThis is the same as the '&' operator.`;\n\nexport class ConcatFunction extends BaseFunction {\n example = 'CONCAT(\"Hello\", \"World\")';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value1',\n description: 'A value to be concatenated with value2.',\n acceptedTypes: ['string', 'number', 'boolean'],\n },\n {\n name: 'value2',\n description: 'A value to be concatenated with value1',\n acceptedTypes: ['string', 'number', 'boolean'],\n },\n ];\n category: FunctionCategory = 'text';\n\n protected main(v1: any, v2: any) {\n return ensureString(v1) + ensureString(v2);\n }\n}\n"],"names":["description","ConcatFunction","BaseFunction","v1","v2","ensureString"],"mappings":";;AAIA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAuBC,EAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,4BACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,UAAU,SAAS;AAAA,MAC/C;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,UAAU,SAAS;AAAA,MAAA;AAAA,IAEjD,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAASC,GAAS;AAC/B,WAAOC,EAAaF,CAAE,IAAIE,EAAaD,CAAE;AAAA,EAAA;AAE7C;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class CountFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=count.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/count.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAY,MAAM,UAAU,CAAC;AAKhG,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,SAAiC;IACxC,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAQhC;IACF,QAAQ,EAAE,gBAAgB,CAAU;IAEpC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE;CAoBhC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseFunction as i, isMatrix as o } from "./__base.js";
|
|
2
|
+
import { eachMatrix as n, ensureNumber as a } from "./__utils.js";
|
|
3
|
+
const u = "Returns the count of a series of numbers or cells.";
|
|
4
|
+
class f extends i {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments), this.example = "COUNT(A2:A100,B2:B100,4,26)", this.description = u, this.defs = [
|
|
7
|
+
{
|
|
8
|
+
name: "value",
|
|
9
|
+
description: "Numbers or ranges to count.",
|
|
10
|
+
takesMatrix: !0,
|
|
11
|
+
acceptedTypes: ["number", "matrix"],
|
|
12
|
+
variadic: !0
|
|
13
|
+
}
|
|
14
|
+
], this.category = "math";
|
|
15
|
+
}
|
|
16
|
+
main(...r) {
|
|
17
|
+
let e = 0;
|
|
18
|
+
return r.forEach((t) => {
|
|
19
|
+
o(t) ? n(
|
|
20
|
+
t,
|
|
21
|
+
(s) => {
|
|
22
|
+
typeof s == "number" && e++;
|
|
23
|
+
},
|
|
24
|
+
this.at
|
|
25
|
+
) : (a(t), e++);
|
|
26
|
+
}), e;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
f as CountFunction
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=count.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"count.js","sources":["../../../src/formula/functions/count.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition, isMatrix } from './__base';\nimport { ensureNumber, eachMatrix } from './__utils';\n\nconst description = `Returns the count of a series of numbers or cells.`;\n\nexport class CountFunction extends BaseFunction {\n example = 'COUNT(A2:A100,B2:B100,4,26)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value',\n description: 'Numbers or ranges to count.',\n takesMatrix: true,\n acceptedTypes: ['number', 'matrix'],\n variadic: true,\n },\n ];\n category: FunctionCategory = 'math';\n\n protected main(...values: any[]) {\n let count = 0;\n values.forEach((val) => {\n if (isMatrix(val)) {\n eachMatrix(\n val,\n (v) => {\n if (typeof v === 'number') {\n count++;\n }\n },\n this.at,\n );\n } else {\n ensureNumber(val);\n count++;\n }\n });\n return count;\n }\n}\n"],"names":["description","CountFunction","BaseFunction","values","count","val","isMatrix","eachMatrix","v","ensureNumber"],"mappings":";;AAGA,MAAMA,IAAc;AAEb,MAAMC,UAAsBC,EAAa;AAAA,EAAzC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,+BACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,QAAQ;AAAA,QAClC,UAAU;AAAA,MAAA;AAAA,IAEd,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,QAAQG,GAAe;AAC/B,QAAIC,IAAQ;AACL,WAAAD,EAAA,QAAQ,CAACE,MAAQ;AAClB,MAAAC,EAASD,CAAG,IACdE;AAAA,QACEF;AAAA,QACA,CAACG,MAAM;AACD,UAAA,OAAOA,KAAM,YACfJ;AAAA,QAEJ;AAAA,QACA,KAAK;AAAA,MACP,KAEAK,EAAaJ,CAAG,GAChBD;AAAA,IACF,CACD,GACMA;AAAA,EAAA;AAEX;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class CountaFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(...values: any[]): number;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=counta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counta.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/counta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAKtF,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,SAAkC;IACzC,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAQhC;IACF,QAAQ,EAAE,gBAAgB,CAAU;IAEpC,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,GAAG,EAAE;CAehC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { BaseFunction as s } from "./__base.js";
|
|
2
|
+
import { eachMatrix as i } from "./__utils.js";
|
|
3
|
+
const n = "Returns the number of values in the data set.";
|
|
4
|
+
class m extends s {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments), this.example = "COUNTA(A2:A100,B2:B100,4,26)", this.description = n, this.defs = [
|
|
7
|
+
{
|
|
8
|
+
name: "value",
|
|
9
|
+
description: "Values or ranges to count.",
|
|
10
|
+
takesMatrix: !0,
|
|
11
|
+
acceptedTypes: ["number", "matrix"],
|
|
12
|
+
variadic: !0
|
|
13
|
+
}
|
|
14
|
+
], this.category = "math";
|
|
15
|
+
}
|
|
16
|
+
main(...r) {
|
|
17
|
+
let t = 0;
|
|
18
|
+
return r.forEach((a) => {
|
|
19
|
+
i(
|
|
20
|
+
a,
|
|
21
|
+
(e) => {
|
|
22
|
+
e != null && e !== "" && t++;
|
|
23
|
+
},
|
|
24
|
+
this.at
|
|
25
|
+
);
|
|
26
|
+
}), t;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export {
|
|
30
|
+
m as CountaFunction
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=counta.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"counta.js","sources":["../../../src/formula/functions/counta.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { eachMatrix } from './__utils';\n\nconst description = `Returns the number of values in the data set.`;\n\nexport class CountaFunction extends BaseFunction {\n example = 'COUNTA(A2:A100,B2:B100,4,26)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value',\n description: 'Values or ranges to count.',\n takesMatrix: true,\n acceptedTypes: ['number', 'matrix'],\n variadic: true,\n },\n ];\n category: FunctionCategory = 'math';\n\n protected main(...values: any[]) {\n let count = 0;\n values.forEach((val) => {\n eachMatrix(\n val,\n (v) => {\n if (v != null && v !== '') {\n count++;\n }\n },\n this.at,\n );\n });\n return count;\n }\n}\n"],"names":["description","CountaFunction","BaseFunction","values","count","val","eachMatrix","v"],"mappings":";;AAGA,MAAMA,IAAc;AAEb,MAAMC,UAAuBC,EAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,gCACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,aAAa;AAAA,QACb,eAAe,CAAC,UAAU,QAAQ;AAAA,QAClC,UAAU;AAAA,MAAA;AAAA,IAEd,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,QAAQG,GAAe;AAC/B,QAAIC,IAAQ;AACL,WAAAD,EAAA,QAAQ,CAACE,MAAQ;AACtB,MAAAC;AAAA,QACED;AAAA,QACA,CAACE,MAAM;AACD,UAAAA,KAAK,QAAQA,MAAM,MACrBH;AAAA,QAEJ;AAAA,QACA,KAAK;AAAA,MACP;AAAA,IAAA,CACD,GACMA;AAAA,EAAA;AAEX;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class DivideFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected validate(args: any[]): any[];
|
|
8
|
+
protected main(divided: number, divisor: number): number;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=divide.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divide.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/divide.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,cAAe,SAAQ,YAAY;IAC9C,OAAO,SAAkB;IACzB,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAWhC;IACF,QAAQ,EAAE,gBAAgB,CAAU;IAEpC,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE;IAQtC,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;CAGhD"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FormulaError as r } from "../formula-error.js";
|
|
2
|
+
import { BaseFunction as n } from "./__base.js";
|
|
3
|
+
import { ensureNumber as o } from "./__utils.js";
|
|
4
|
+
const s = `Returns the result of dividing one number by another.
|
|
5
|
+
This is the same as the '/' operator.`;
|
|
6
|
+
class c extends n {
|
|
7
|
+
constructor() {
|
|
8
|
+
super(...arguments), this.example = "DIVIDE(4, 2)", this.description = s, this.defs = [
|
|
9
|
+
{
|
|
10
|
+
name: "dividend",
|
|
11
|
+
description: "A number that will be divided by divisor.",
|
|
12
|
+
acceptedTypes: ["number"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "divisor",
|
|
16
|
+
description: "A number that will divide a dividend. Must be non-zero.",
|
|
17
|
+
acceptedTypes: ["number"]
|
|
18
|
+
}
|
|
19
|
+
], this.category = "math";
|
|
20
|
+
}
|
|
21
|
+
validate(t) {
|
|
22
|
+
const e = super.validate(t).map((i) => o(i));
|
|
23
|
+
if (e[1] === 0)
|
|
24
|
+
throw new r("#DIV/0!", "The second argument must be non-zero.");
|
|
25
|
+
return e;
|
|
26
|
+
}
|
|
27
|
+
main(t, e) {
|
|
28
|
+
return t / e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
c as DivideFunction
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=divide.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"divide.js","sources":["../../../src/formula/functions/divide.ts"],"sourcesContent":["import { FormulaError } from '../formula-error';\nimport { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { ensureNumber } from './__utils';\n\nconst description = `Returns the result of dividing one number by another.\nThis is the same as the '/' operator.`;\n\nexport class DivideFunction extends BaseFunction {\n example = 'DIVIDE(4, 2)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'dividend',\n description: 'A number that will be divided by divisor.',\n acceptedTypes: ['number'],\n },\n {\n name: 'divisor',\n description: 'A number that will divide a dividend. Must be non-zero.',\n acceptedTypes: ['number'],\n },\n ];\n category: FunctionCategory = 'math';\n\n protected validate(args: any[]): any[] {\n const validated = super.validate(args).map((arg) => ensureNumber(arg));\n if (validated[1] === 0) {\n throw new FormulaError('#DIV/0!', 'The second argument must be non-zero.');\n }\n return validated;\n }\n\n protected main(divided: number, divisor: number) {\n return divided / divisor;\n }\n}\n"],"names":["description","DivideFunction","BaseFunction","args","validated","arg","ensureNumber","FormulaError","divided","divisor"],"mappings":";;;AAIA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAuBC,EAAa;AAAA,EAA1C,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,gBACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,QAAQ;AAAA,MAC1B;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,QAAQ;AAAA,MAAA;AAAA,IAE5B,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,SAASG,GAAoB;AAC/B,UAAAC,IAAY,MAAM,SAASD,CAAI,EAAE,IAAI,CAACE,MAAQC,EAAaD,CAAG,CAAC;AACjE,QAAAD,EAAU,CAAC,MAAM;AACb,YAAA,IAAIG,EAAa,WAAW,uCAAuC;AAEpE,WAAAH;AAAA,EAAA;AAAA,EAGC,KAAKI,GAAiBC,GAAiB;AAC/C,WAAOD,IAAUC;AAAA,EAAA;AAErB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class EqFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=eq.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eq.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/eq.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,SAAc;IACrB,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAGhC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IAEvC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;CAGhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFunction as s } from "./__base.js";
|
|
2
|
+
import { eq as a } from "./__utils.js";
|
|
3
|
+
const i = `Returns TRUE if the two specified values are equal, FALSE if they are not.
|
|
4
|
+
This is the same as the '=' operator.`;
|
|
5
|
+
class c extends s {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = "EQ(6, 7)", this.description = i, this.defs = [
|
|
8
|
+
{ name: "value1", description: "First value.", acceptedTypes: ["any"] },
|
|
9
|
+
{ name: "value2", description: "A value to be compared with value1.", acceptedTypes: ["any"] }
|
|
10
|
+
], this.category = "logical";
|
|
11
|
+
}
|
|
12
|
+
main(e, t) {
|
|
13
|
+
return a(e, t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as EqFunction
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=eq.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eq.js","sources":["../../../src/formula/functions/eq.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { eq } from './__utils';\n\nconst description = `Returns TRUE if the two specified values are equal, FALSE if they are not.\nThis is the same as the '=' operator.`;\n\nexport class EqFunction extends BaseFunction {\n example = 'EQ(6, 7)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n { name: 'value1', description: 'First value.', acceptedTypes: ['any'] },\n { name: 'value2', description: 'A value to be compared with value1.', acceptedTypes: ['any'] },\n ];\n category: FunctionCategory = 'logical';\n\n protected main(v1: any, v2: any) {\n return eq(v1, v2);\n }\n}\n"],"names":["description","EqFunction","BaseFunction","v1","v2","eq"],"mappings":";;AAGA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAmBC,EAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,YACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC,EAAE,MAAM,UAAU,aAAa,gBAAgB,eAAe,CAAC,KAAK,EAAE;AAAA,MACtE,EAAE,MAAM,UAAU,aAAa,uCAAuC,eAAe,CAAC,KAAK,EAAE;AAAA,IAC/F,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAASC,GAAS;AACxB,WAAAC,EAAGF,GAAIC,CAAE;AAAA,EAAA;AAEpB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class GtFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=gt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gt.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/gt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,SAAc;IACrB,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAGhC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IAEvC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;CAGhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFunction as s } from "./__base.js";
|
|
2
|
+
import { gt as r } from "./__utils.js";
|
|
3
|
+
const i = `Returns TRUE if the first argument is truly greater than the second, FALSE otherwise.
|
|
4
|
+
This is the same as the '>' operator.`;
|
|
5
|
+
class c extends s {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = "GT(5, 3)", this.description = i, this.defs = [
|
|
8
|
+
{ name: "value1", description: "First value.", acceptedTypes: ["any"] },
|
|
9
|
+
{ name: "value2", description: "A value to be compared with value1.", acceptedTypes: ["any"] }
|
|
10
|
+
], this.category = "logical";
|
|
11
|
+
}
|
|
12
|
+
main(e, t) {
|
|
13
|
+
return r(e, t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as GtFunction
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=gt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gt.js","sources":["../../../src/formula/functions/gt.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { gt } from './__utils';\n\nconst description = `Returns TRUE if the first argument is truly greater than the second, FALSE otherwise.\nThis is the same as the '>' operator.`;\n\nexport class GtFunction extends BaseFunction {\n example = 'GT(5, 3)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n { name: 'value1', description: 'First value.', acceptedTypes: ['any'] },\n { name: 'value2', description: 'A value to be compared with value1.', acceptedTypes: ['any'] },\n ];\n category: FunctionCategory = 'logical';\n\n protected main(v1: any, v2: any) {\n return gt(v1, v2);\n }\n}\n"],"names":["description","GtFunction","BaseFunction","v1","v2","gt"],"mappings":";;AAGA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAmBC,EAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,YACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC,EAAE,MAAM,UAAU,aAAa,gBAAgB,eAAe,CAAC,KAAK,EAAE;AAAA,MACtE,EAAE,MAAM,UAAU,aAAa,uCAAuC,eAAe,CAAC,KAAK,EAAE;AAAA,IAC/F,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAASC,GAAS;AACxB,WAAAC,EAAGF,GAAIC,CAAE;AAAA,EAAA;AAEpB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class GteFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(v1: any, v2: any): boolean;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=gte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gte.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/gte.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAe;IACtB,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAGhC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IAEvC,SAAS,CAAC,IAAI,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG;CAGhC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFunction as s } from "./__base.js";
|
|
2
|
+
import { gte as i } from "./__utils.js";
|
|
3
|
+
const r = `Returns TRUE if the first argument is greater than the second, FALSE otherwise.
|
|
4
|
+
This is the same as the '>=' operator.`;
|
|
5
|
+
class c extends s {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = "GTE(5, 3)", this.description = r, this.defs = [
|
|
8
|
+
{ name: "value1", description: "First value.", acceptedTypes: ["any"] },
|
|
9
|
+
{ name: "value2", description: "A value to be compared with value1.", acceptedTypes: ["any"] }
|
|
10
|
+
], this.category = "logical";
|
|
11
|
+
}
|
|
12
|
+
main(e, t) {
|
|
13
|
+
return i(e, t);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
export {
|
|
17
|
+
c as GteFunction
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=gte.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gte.js","sources":["../../../src/formula/functions/gte.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { gte } from './__utils';\n\nconst description = `Returns TRUE if the first argument is greater than the second, FALSE otherwise.\nThis is the same as the '>=' operator.`;\n\nexport class GteFunction extends BaseFunction {\n example = 'GTE(5, 3)';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n { name: 'value1', description: 'First value.', acceptedTypes: ['any'] },\n { name: 'value2', description: 'A value to be compared with value1.', acceptedTypes: ['any'] },\n ];\n category: FunctionCategory = 'logical';\n\n protected main(v1: any, v2: any) {\n return gte(v1, v2);\n }\n}\n"],"names":["description","GteFunction","BaseFunction","v1","v2","gte"],"mappings":";;AAGA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAoBC,EAAa;AAAA,EAAvC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,aACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC,EAAE,MAAM,UAAU,aAAa,gBAAgB,eAAe,CAAC,KAAK,EAAE;AAAA,MACtE,EAAE,MAAM,UAAU,aAAa,uCAAuC,eAAe,CAAC,KAAK,EAAE;AAAA,IAC/F,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAASC,GAAS;AACxB,WAAAC,EAAIF,GAAIC,CAAE;AAAA,EAAA;AAErB;"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';
|
|
2
|
+
export declare class IfFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected main(condition: any, v1: any, v2?: any): any;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=if.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/if.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,MAAM,UAAU,CAAC;AAMtF,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,SAAwC;IAC/C,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAahC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IAEvC,SAAS,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,EAAE,GAAE,GAAW;CAGxD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { BaseFunction as i } from "./__base.js";
|
|
2
|
+
import { ensureBoolean as o } from "./__utils.js";
|
|
3
|
+
const s = `If the logical expression is TRUE, the second argument is returned.
|
|
4
|
+
If FALSE, the third argument is returned.`;
|
|
5
|
+
class d extends i {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments), this.example = 'IF(A2 = "Human", "Hello", "World")', this.description = s, this.defs = [
|
|
8
|
+
{ name: "condition", description: "An expression as a condition", acceptedTypes: ["any"] },
|
|
9
|
+
{
|
|
10
|
+
name: "value1",
|
|
11
|
+
description: "value to be returned if the condition is true.",
|
|
12
|
+
acceptedTypes: ["any"]
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "value2",
|
|
16
|
+
description: "value to be returned if the condition is false.",
|
|
17
|
+
optional: !0,
|
|
18
|
+
acceptedTypes: ["any"]
|
|
19
|
+
}
|
|
20
|
+
], this.category = "logical";
|
|
21
|
+
}
|
|
22
|
+
main(e, t, n = !1) {
|
|
23
|
+
return o(e) ? t : n;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
d as IfFunction
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=if.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"if.js","sources":["../../../src/formula/functions/if.ts"],"sourcesContent":["import { BaseFunction, FunctionCategory, FunctionArgumentDefinition } from './__base';\nimport { ensureBoolean } from './__utils';\n\nconst description = `If the logical expression is TRUE, the second argument is returned.\nIf FALSE, the third argument is returned.`;\n\nexport class IfFunction extends BaseFunction {\n example = 'IF(A2 = \"Human\", \"Hello\", \"World\")';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n { name: 'condition', description: 'An expression as a condition', acceptedTypes: ['any'] },\n {\n name: 'value1',\n description: 'value to be returned if the condition is true.',\n acceptedTypes: ['any'],\n },\n {\n name: 'value2',\n description: 'value to be returned if the condition is false.',\n optional: true,\n acceptedTypes: ['any'],\n },\n ];\n category: FunctionCategory = 'logical';\n\n protected main(condition: any, v1: any, v2: any = false) {\n return ensureBoolean(condition) ? v1 : v2;\n }\n}\n"],"names":["description","IfFunction","BaseFunction","condition","v1","v2","ensureBoolean"],"mappings":";;AAGA,MAAMA,IAAc;AAAA;AAGb,MAAMC,UAAmBC,EAAa;AAAA,EAAtC,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,sCACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC,EAAE,MAAM,aAAa,aAAa,gCAAgC,eAAe,CAAC,KAAK,EAAE;AAAA,MACzF;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,KAAK;AAAA,MACvB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,eAAe,CAAC,KAAK;AAAA,MAAA;AAAA,IAEzB,GAC6B,KAAA,WAAA;AAAA,EAAA;AAAA,EAEnB,KAAKG,GAAgBC,GAASC,IAAU,IAAO;AAChD,WAAAC,EAAcH,CAAS,IAAIC,IAAKC;AAAA,EAAA;AAE3C;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FunctionArgumentDefinition, BaseFunction, FunctionCategory } from './__base';
|
|
2
|
+
export declare class IfErrorFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
description: string;
|
|
5
|
+
defs: FunctionArgumentDefinition[];
|
|
6
|
+
category: FunctionCategory;
|
|
7
|
+
protected broadcastDisabled: boolean;
|
|
8
|
+
protected main(value: any, valueIfError?: any): any;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=iferror.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iferror.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/iferror.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,0BAA0B,EAC1B,YAAY,EACZ,gBAAgB,EAIjB,MAAM,UAAU,CAAC;AAIlB,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAAqC;IAC5C,WAAW,SAAe;IAC1B,IAAI,EAAE,0BAA0B,EAAE,CAahC;IACF,QAAQ,EAAE,gBAAgB,CAAa;IACvC,SAAS,CAAC,iBAAiB,UAAQ;IAEnC,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE,YAAY,CAAC,EAAE,GAAG;CAM9C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FormulaError as t } from "../formula-error.js";
|
|
2
|
+
import { BaseFunction as n } from "./__base.js";
|
|
3
|
+
const i = "Returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.";
|
|
4
|
+
class u extends n {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments), this.example = 'IFERROR(A1, "Error in cell A1")', this.description = i, this.defs = [
|
|
7
|
+
{
|
|
8
|
+
name: "value",
|
|
9
|
+
description: "The value to return if value itself is not an error.",
|
|
10
|
+
acceptedTypes: ["any"],
|
|
11
|
+
errorTolerant: !0
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: "value_if_error",
|
|
15
|
+
description: "The value the function returns if value is an error.",
|
|
16
|
+
optional: !0,
|
|
17
|
+
acceptedTypes: ["any"]
|
|
18
|
+
}
|
|
19
|
+
], this.category = "logical", this.broadcastDisabled = !0;
|
|
20
|
+
}
|
|
21
|
+
main(r, e) {
|
|
22
|
+
return t.is(r) || r instanceof Error ? e : r;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
u as IfErrorFunction
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=iferror.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"iferror.js","sources":["../../../src/formula/functions/iferror.ts"],"sourcesContent":["// DO NOT COPY THIS CODE FOR THE OTHER.\nimport { FormulaError } from '../formula-error';\nimport {\n FunctionArgumentDefinition,\n BaseFunction,\n FunctionCategory,\n isMatrix,\n isMultiCell,\n stripMatrix,\n} from './__base';\n\nconst description = `Returns the first argument if it is not an error value, otherwise returns the second argument if present, or a blank if the second argument is absent.`;\n\nexport class IfErrorFunction extends BaseFunction {\n example = 'IFERROR(A1, \"Error in cell A1\")';\n description = description;\n defs: FunctionArgumentDefinition[] = [\n {\n name: 'value',\n description: 'The value to return if value itself is not an error.',\n acceptedTypes: ['any'],\n errorTolerant: true,\n },\n {\n name: 'value_if_error',\n description: 'The value the function returns if value is an error.',\n optional: true,\n acceptedTypes: ['any'],\n },\n ];\n category: FunctionCategory = 'logical';\n protected broadcastDisabled = true;\n\n protected main(value: any, valueIfError?: any) {\n if (FormulaError.is(value) || value instanceof Error) {\n return valueIfError;\n }\n return value;\n }\n}\n"],"names":["description","IfErrorFunction","BaseFunction","value","valueIfError","FormulaError"],"mappings":";;AAWA,MAAMA,IAAc;AAEb,MAAMC,UAAwBC,EAAa;AAAA,EAA3C,cAAA;AAAA,UAAA,GAAA,SAAA,GACK,KAAA,UAAA,mCACI,KAAA,cAAAF,GACuB,KAAA,OAAA;AAAA,MACnC;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,eAAe,CAAC,KAAK;AAAA,QACrB,eAAe;AAAA,MACjB;AAAA,MACA;AAAA,QACE,MAAM;AAAA,QACN,aAAa;AAAA,QACb,UAAU;AAAA,QACV,eAAe,CAAC,KAAK;AAAA,MAAA;AAAA,IAEzB,GAC6B,KAAA,WAAA,WAC7B,KAAU,oBAAoB;AAAA,EAAA;AAAA,EAEpB,KAAKG,GAAYC,GAAoB;AAC7C,WAAIC,EAAa,GAAGF,CAAK,KAAKA,aAAiB,QACtCC,IAEFD;AAAA,EAAA;AAEX;"}
|