@gridsheet/react-core 0.12.0-rc.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/LICENSE +190 -0
- package/README.md +84 -0
- package/dist/components/Cell.d.ts +8 -0
- package/dist/components/Cell.d.ts.map +1 -0
- package/dist/components/Cell.js +195 -0
- package/dist/components/Cell.js.map +1 -0
- package/dist/components/ContextMenu.d.ts +3 -0
- package/dist/components/ContextMenu.d.ts.map +1 -0
- package/dist/components/ContextMenu.js +207 -0
- package/dist/components/ContextMenu.js.map +1 -0
- package/dist/components/Editor.d.ts +3 -0
- package/dist/components/Editor.d.ts.map +1 -0
- package/dist/components/Editor.js +304 -0
- package/dist/components/Editor.js.map +1 -0
- package/dist/components/Emitter.d.ts +9 -0
- package/dist/components/Emitter.d.ts.map +1 -0
- package/dist/components/Emitter.js +26 -0
- package/dist/components/Emitter.js.map +1 -0
- package/dist/components/GridSheet.d.ts +4 -0
- package/dist/components/GridSheet.d.ts.map +1 -0
- package/dist/components/GridSheet.js +110 -0
- package/dist/components/GridSheet.js.map +1 -0
- package/dist/components/HeaderLeftCell.d.ts +7 -0
- package/dist/components/HeaderLeftCell.d.ts.map +1 -0
- package/dist/components/HeaderLeftCell.js +67 -0
- package/dist/components/HeaderLeftCell.js.map +1 -0
- package/dist/components/HeaderTopCell.d.ts +7 -0
- package/dist/components/HeaderTopCell.d.ts.map +1 -0
- package/dist/components/HeaderTopCell.js +68 -0
- package/dist/components/HeaderTopCell.js.map +1 -0
- package/dist/components/Resizer.d.ts +3 -0
- package/dist/components/Resizer.d.ts.map +1 -0
- package/dist/components/Resizer.js +83 -0
- package/dist/components/Resizer.js.map +1 -0
- package/dist/components/SearchBox.d.ts +3 -0
- package/dist/components/SearchBox.d.ts.map +1 -0
- package/dist/components/SearchBox.js +52 -0
- package/dist/components/SearchBox.js.map +1 -0
- package/dist/components/StoreInitializer.d.ts +4 -0
- package/dist/components/StoreInitializer.d.ts.map +1 -0
- package/dist/components/StoreInitializer.js +68 -0
- package/dist/components/StoreInitializer.js.map +1 -0
- package/dist/components/Tabular.d.ts +9 -0
- package/dist/components/Tabular.d.ts.map +1 -0
- package/dist/components/Tabular.js +84 -0
- package/dist/components/Tabular.js.map +1 -0
- package/dist/constants.d.ts +18 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +21 -0
- package/dist/constants.js.map +1 -0
- package/dist/formula/evaluator.d.ts +91 -0
- package/dist/formula/evaluator.d.ts.map +1 -0
- package/dist/formula/evaluator.js +541 -0
- package/dist/formula/evaluator.js.map +1 -0
- package/dist/formula/functions/__base.d.ts +23 -0
- package/dist/formula/functions/__base.d.ts.map +1 -0
- package/dist/formula/functions/__base.js +16 -0
- package/dist/formula/functions/__base.js.map +1 -0
- package/dist/formula/functions/__utils.d.ts +6 -0
- package/dist/formula/functions/__utils.d.ts.map +1 -0
- package/dist/formula/functions/__utils.js +102 -0
- package/dist/formula/functions/__utils.js.map +1 -0
- package/dist/formula/functions/abs.d.ts +12 -0
- package/dist/formula/functions/abs.d.ts.map +1 -0
- package/dist/formula/functions/abs.js +21 -0
- package/dist/formula/functions/abs.js.map +1 -0
- package/dist/formula/functions/abs.spec.d.ts +2 -0
- package/dist/formula/functions/abs.spec.d.ts.map +1 -0
- package/dist/formula/functions/abs.spec.js +29 -0
- package/dist/formula/functions/abs.spec.js.map +1 -0
- package/dist/formula/functions/acos.d.ts +12 -0
- package/dist/formula/functions/acos.d.ts.map +1 -0
- package/dist/formula/functions/acos.js +29 -0
- package/dist/formula/functions/acos.js.map +1 -0
- package/dist/formula/functions/add.d.ts +13 -0
- package/dist/formula/functions/add.d.ts.map +1 -0
- package/dist/formula/functions/add.js +50 -0
- package/dist/formula/functions/add.js.map +1 -0
- package/dist/formula/functions/and.d.ts +19 -0
- package/dist/formula/functions/and.d.ts.map +1 -0
- package/dist/formula/functions/and.js +28 -0
- package/dist/formula/functions/and.js.map +1 -0
- package/dist/formula/functions/asin.d.ts +12 -0
- package/dist/formula/functions/asin.d.ts.map +1 -0
- package/dist/formula/functions/asin.js +29 -0
- package/dist/formula/functions/asin.js.map +1 -0
- package/dist/formula/functions/atan.d.ts +12 -0
- package/dist/formula/functions/atan.d.ts.map +1 -0
- package/dist/formula/functions/atan.js +26 -0
- package/dist/formula/functions/atan.js.map +1 -0
- package/dist/formula/functions/atan2.d.ts +12 -0
- package/dist/formula/functions/atan2.d.ts.map +1 -0
- package/dist/formula/functions/atan2.js +32 -0
- package/dist/formula/functions/atan2.js.map +1 -0
- package/dist/formula/functions/average.d.ts +19 -0
- package/dist/formula/functions/average.d.ts.map +1 -0
- package/dist/formula/functions/average.js +41 -0
- package/dist/formula/functions/average.js.map +1 -0
- package/dist/formula/functions/col.d.ts +14 -0
- package/dist/formula/functions/col.d.ts.map +1 -0
- package/dist/formula/functions/col.js +30 -0
- package/dist/formula/functions/col.js.map +1 -0
- package/dist/formula/functions/concat.d.ts +12 -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/concatenate.d.ts +19 -0
- package/dist/formula/functions/concatenate.d.ts.map +1 -0
- package/dist/formula/functions/concatenate.js +25 -0
- package/dist/formula/functions/concatenate.js.map +1 -0
- package/dist/formula/functions/cos.d.ts +12 -0
- package/dist/formula/functions/cos.d.ts.map +1 -0
- package/dist/formula/functions/cos.js +26 -0
- package/dist/formula/functions/cos.js.map +1 -0
- package/dist/formula/functions/count.d.ts +19 -0
- package/dist/formula/functions/count.d.ts.map +1 -0
- package/dist/formula/functions/count.js +35 -0
- package/dist/formula/functions/count.js.map +1 -0
- package/dist/formula/functions/counta.d.ts +19 -0
- package/dist/formula/functions/counta.d.ts.map +1 -0
- package/dist/formula/functions/counta.js +35 -0
- package/dist/formula/functions/counta.js.map +1 -0
- package/dist/formula/functions/countif.d.ts +13 -0
- package/dist/formula/functions/countif.d.ts.map +1 -0
- package/dist/formula/functions/countif.js +30 -0
- package/dist/formula/functions/countif.js.map +1 -0
- package/dist/formula/functions/divide.d.ts +12 -0
- package/dist/formula/functions/divide.d.ts.map +1 -0
- package/dist/formula/functions/divide.js +33 -0
- package/dist/formula/functions/divide.js.map +1 -0
- package/dist/formula/functions/eq.d.ts +12 -0
- package/dist/formula/functions/eq.d.ts.map +1 -0
- package/dist/formula/functions/eq.js +25 -0
- package/dist/formula/functions/eq.js.map +1 -0
- package/dist/formula/functions/exp.d.ts +12 -0
- package/dist/formula/functions/exp.d.ts.map +1 -0
- package/dist/formula/functions/exp.js +28 -0
- package/dist/formula/functions/exp.js.map +1 -0
- package/dist/formula/functions/gt.d.ts +12 -0
- package/dist/formula/functions/gt.d.ts.map +1 -0
- package/dist/formula/functions/gt.js +27 -0
- package/dist/formula/functions/gt.js.map +1 -0
- package/dist/formula/functions/gte.d.ts +12 -0
- package/dist/formula/functions/gte.d.ts.map +1 -0
- package/dist/formula/functions/gte.js +27 -0
- package/dist/formula/functions/gte.js.map +1 -0
- package/dist/formula/functions/hlookup.d.ts +18 -0
- package/dist/formula/functions/hlookup.d.ts.map +1 -0
- package/dist/formula/functions/hlookup.js +74 -0
- package/dist/formula/functions/hlookup.js.map +1 -0
- package/dist/formula/functions/if.d.ts +17 -0
- package/dist/formula/functions/if.d.ts.map +1 -0
- package/dist/formula/functions/if.js +36 -0
- package/dist/formula/functions/if.js.map +1 -0
- package/dist/formula/functions/iferror.d.ts +20 -0
- package/dist/formula/functions/iferror.d.ts.map +1 -0
- package/dist/formula/functions/iferror.js +41 -0
- package/dist/formula/functions/iferror.js.map +1 -0
- package/dist/formula/functions/iferror.spec.d.ts +2 -0
- package/dist/formula/functions/iferror.spec.d.ts.map +1 -0
- package/dist/formula/functions/iferror.spec.js +61 -0
- package/dist/formula/functions/iferror.spec.js.map +1 -0
- package/dist/formula/functions/len.d.ts +12 -0
- package/dist/formula/functions/len.d.ts.map +1 -0
- package/dist/formula/functions/len.js +26 -0
- package/dist/formula/functions/len.js.map +1 -0
- package/dist/formula/functions/lenb.d.ts +12 -0
- package/dist/formula/functions/lenb.d.ts.map +1 -0
- package/dist/formula/functions/lenb.js +26 -0
- package/dist/formula/functions/lenb.js.map +1 -0
- package/dist/formula/functions/ln.d.ts +12 -0
- package/dist/formula/functions/ln.d.ts.map +1 -0
- package/dist/formula/functions/ln.js +29 -0
- package/dist/formula/functions/ln.js.map +1 -0
- package/dist/formula/functions/log.d.ts +12 -0
- package/dist/formula/functions/log.d.ts.map +1 -0
- package/dist/formula/functions/log.js +35 -0
- package/dist/formula/functions/log.js.map +1 -0
- package/dist/formula/functions/log10.d.ts +12 -0
- package/dist/formula/functions/log10.d.ts.map +1 -0
- package/dist/formula/functions/log10.js +29 -0
- package/dist/formula/functions/log10.js.map +1 -0
- package/dist/formula/functions/lt.d.ts +12 -0
- package/dist/formula/functions/lt.d.ts.map +1 -0
- package/dist/formula/functions/lt.js +27 -0
- package/dist/formula/functions/lt.js.map +1 -0
- package/dist/formula/functions/lte.d.ts +12 -0
- package/dist/formula/functions/lte.d.ts.map +1 -0
- package/dist/formula/functions/lte.js +27 -0
- package/dist/formula/functions/lte.js.map +1 -0
- package/dist/formula/functions/max.d.ts +19 -0
- package/dist/formula/functions/max.d.ts.map +1 -0
- package/dist/formula/functions/max.js +44 -0
- package/dist/formula/functions/max.js.map +1 -0
- package/dist/formula/functions/min.d.ts +19 -0
- package/dist/formula/functions/min.d.ts.map +1 -0
- package/dist/formula/functions/min.js +44 -0
- package/dist/formula/functions/min.js.map +1 -0
- package/dist/formula/functions/minus.d.ts +13 -0
- package/dist/formula/functions/minus.d.ts.map +1 -0
- package/dist/formula/functions/minus.js +50 -0
- package/dist/formula/functions/minus.js.map +1 -0
- package/dist/formula/functions/mod.d.ts +12 -0
- package/dist/formula/functions/mod.d.ts.map +1 -0
- package/dist/formula/functions/mod.js +31 -0
- package/dist/formula/functions/mod.js.map +1 -0
- package/dist/formula/functions/mod.spec.d.ts +2 -0
- package/dist/formula/functions/mod.spec.d.ts.map +1 -0
- package/dist/formula/functions/mod.spec.js +52 -0
- package/dist/formula/functions/mod.spec.js.map +1 -0
- package/dist/formula/functions/multiply.d.ts +12 -0
- package/dist/formula/functions/multiply.d.ts.map +1 -0
- package/dist/formula/functions/multiply.js +27 -0
- package/dist/formula/functions/multiply.js.map +1 -0
- package/dist/formula/functions/ne.d.ts +12 -0
- package/dist/formula/functions/ne.d.ts.map +1 -0
- package/dist/formula/functions/ne.js +25 -0
- package/dist/formula/functions/ne.js.map +1 -0
- package/dist/formula/functions/not.d.ts +12 -0
- package/dist/formula/functions/not.d.ts.map +1 -0
- package/dist/formula/functions/not.js +30 -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 +21 -0
- package/dist/formula/functions/now.js.map +1 -0
- package/dist/formula/functions/or.d.ts +19 -0
- package/dist/formula/functions/or.d.ts.map +1 -0
- package/dist/formula/functions/or.js +28 -0
- package/dist/formula/functions/or.js.map +1 -0
- package/dist/formula/functions/pi.d.ts +9 -0
- package/dist/formula/functions/pi.d.ts.map +1 -0
- package/dist/formula/functions/pi.js +19 -0
- package/dist/formula/functions/pi.js.map +1 -0
- package/dist/formula/functions/power.d.ts +12 -0
- package/dist/formula/functions/power.d.ts.map +1 -0
- package/dist/formula/functions/power.js +24 -0
- package/dist/formula/functions/power.js.map +1 -0
- package/dist/formula/functions/product.d.ts +19 -0
- package/dist/formula/functions/product.d.ts.map +1 -0
- package/dist/formula/functions/product.js +37 -0
- package/dist/formula/functions/product.js.map +1 -0
- package/dist/formula/functions/radians.d.ts +12 -0
- package/dist/formula/functions/radians.d.ts.map +1 -0
- package/dist/formula/functions/radians.js +26 -0
- package/dist/formula/functions/radians.js.map +1 -0
- package/dist/formula/functions/rand.d.ts +9 -0
- package/dist/formula/functions/rand.d.ts.map +1 -0
- package/dist/formula/functions/rand.js +19 -0
- package/dist/formula/functions/rand.js.map +1 -0
- package/dist/formula/functions/round.d.ts +17 -0
- package/dist/formula/functions/round.d.ts.map +1 -0
- package/dist/formula/functions/round.js +34 -0
- package/dist/formula/functions/round.js.map +1 -0
- package/dist/formula/functions/rounddown.d.ts +17 -0
- package/dist/formula/functions/rounddown.d.ts.map +1 -0
- package/dist/formula/functions/rounddown.js +34 -0
- package/dist/formula/functions/rounddown.js.map +1 -0
- package/dist/formula/functions/roundup.d.ts +17 -0
- package/dist/formula/functions/roundup.d.ts.map +1 -0
- package/dist/formula/functions/roundup.js +34 -0
- package/dist/formula/functions/roundup.js.map +1 -0
- package/dist/formula/functions/row.d.ts +14 -0
- package/dist/formula/functions/row.d.ts.map +1 -0
- package/dist/formula/functions/row.js +30 -0
- package/dist/formula/functions/row.js.map +1 -0
- package/dist/formula/functions/sin.d.ts +12 -0
- package/dist/formula/functions/sin.d.ts.map +1 -0
- package/dist/formula/functions/sin.js +26 -0
- package/dist/formula/functions/sin.js.map +1 -0
- package/dist/formula/functions/sqrt.d.ts +12 -0
- package/dist/formula/functions/sqrt.d.ts.map +1 -0
- package/dist/formula/functions/sqrt.js +29 -0
- package/dist/formula/functions/sqrt.js.map +1 -0
- package/dist/formula/functions/sum.d.ts +19 -0
- package/dist/formula/functions/sum.d.ts.map +1 -0
- package/dist/formula/functions/sum.js +44 -0
- package/dist/formula/functions/sum.js.map +1 -0
- package/dist/formula/functions/sum.spec.d.ts +2 -0
- package/dist/formula/functions/sum.spec.d.ts.map +1 -0
- package/dist/formula/functions/sum.spec.js +40 -0
- package/dist/formula/functions/sum.spec.js.map +1 -0
- package/dist/formula/functions/sumif.d.ts +18 -0
- package/dist/formula/functions/sumif.d.ts.map +1 -0
- package/dist/formula/functions/sumif.js +59 -0
- package/dist/formula/functions/sumif.js.map +1 -0
- package/dist/formula/functions/tan.d.ts +12 -0
- package/dist/formula/functions/tan.d.ts.map +1 -0
- package/dist/formula/functions/tan.js +26 -0
- package/dist/formula/functions/tan.js.map +1 -0
- package/dist/formula/functions/uminus.d.ts +12 -0
- package/dist/formula/functions/uminus.d.ts.map +1 -0
- package/dist/formula/functions/uminus.js +23 -0
- package/dist/formula/functions/uminus.js.map +1 -0
- package/dist/formula/functions/vlookup.d.ts +18 -0
- package/dist/formula/functions/vlookup.d.ts.map +1 -0
- package/dist/formula/functions/vlookup.js +74 -0
- package/dist/formula/functions/vlookup.js.map +1 -0
- package/dist/formula/mapping.d.ts +114 -0
- package/dist/formula/mapping.d.ts.map +1 -0
- package/dist/formula/mapping.js +114 -0
- package/dist/formula/mapping.js.map +1 -0
- package/dist/formula/solver.d.ts +12 -0
- package/dist/formula/solver.d.ts.map +1 -0
- package/dist/formula/solver.js +64 -0
- package/dist/formula/solver.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/autofill.d.ts +17 -0
- package/dist/lib/autofill.d.ts.map +1 -0
- package/dist/lib/autofill.js +389 -0
- package/dist/lib/autofill.js.map +1 -0
- package/dist/lib/clipboard.d.ts +3 -0
- package/dist/lib/clipboard.d.ts.map +1 -0
- package/dist/lib/clipboard.js +45 -0
- package/dist/lib/clipboard.js.map +1 -0
- package/dist/lib/converters.d.ts +10 -0
- package/dist/lib/converters.d.ts.map +1 -0
- package/dist/lib/converters.js +127 -0
- package/dist/lib/converters.js.map +1 -0
- package/dist/lib/structs.d.ts +60 -0
- package/dist/lib/structs.d.ts.map +1 -0
- package/dist/lib/structs.js +251 -0
- package/dist/lib/structs.js.map +1 -0
- package/dist/lib/table.d.ts +303 -0
- package/dist/lib/table.d.ts.map +1 -0
- package/dist/lib/table.js +989 -0
- package/dist/lib/table.js.map +1 -0
- package/dist/lib/time.d.ts +14 -0
- package/dist/lib/time.d.ts.map +1 -0
- package/dist/lib/time.js +60 -0
- package/dist/lib/time.js.map +1 -0
- package/dist/lib/virtualization.d.ts +30 -0
- package/dist/lib/virtualization.d.ts.map +1 -0
- package/dist/lib/virtualization.js +114 -0
- package/dist/lib/virtualization.js.map +1 -0
- package/dist/parsers/core.d.ts +36 -0
- package/dist/parsers/core.d.ts.map +1 -0
- package/dist/parsers/core.js +123 -0
- package/dist/parsers/core.js.map +1 -0
- package/dist/renderers/checkbox.d.ts +5 -0
- package/dist/renderers/checkbox.d.ts.map +1 -0
- package/dist/renderers/checkbox.js +10 -0
- package/dist/renderers/checkbox.js.map +1 -0
- package/dist/renderers/core.d.ts +48 -0
- package/dist/renderers/core.d.ts.map +1 -0
- package/dist/renderers/core.js +143 -0
- package/dist/renderers/core.js.map +1 -0
- package/dist/renderers/thousand_separator.d.ts +5 -0
- package/dist/renderers/thousand_separator.d.ts.map +1 -0
- package/dist/renderers/thousand_separator.js +14 -0
- package/dist/renderers/thousand_separator.js.map +1 -0
- package/dist/store/actions.d.ts +198 -0
- package/dist/store/actions.d.ts.map +1 -0
- package/dist/store/actions.js +519 -0
- package/dist/store/actions.js.map +1 -0
- package/dist/store/helpers.d.ts +28 -0
- package/dist/store/helpers.d.ts.map +1 -0
- package/dist/store/helpers.js +78 -0
- package/dist/store/helpers.js.map +1 -0
- package/dist/store/index.d.ts +11 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +3 -0
- package/dist/store/index.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 +16 -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 +4 -0
- package/dist/styles/minified.js.map +1 -0
- package/dist/types.d.ts +213 -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 +7 -0
- package/dist/utils.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
import { ensureBoolean } from "./__utils";
|
|
3
|
+
export class OrFunction extends BaseFunction {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.example = "OR(A1=1, A2=2)";
|
|
7
|
+
this.helpText = [
|
|
8
|
+
"Returns TRUE if any argument is logically true.",
|
|
9
|
+
"Returns FALSE if all arguments are logically false.",
|
|
10
|
+
];
|
|
11
|
+
this.helpArgs = [
|
|
12
|
+
{ name: "expression1", description: "First logical expression." },
|
|
13
|
+
{
|
|
14
|
+
name: "expression2",
|
|
15
|
+
description: "Additional expressions",
|
|
16
|
+
optional: true,
|
|
17
|
+
iterable: true,
|
|
18
|
+
},
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
validate() {
|
|
22
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureBoolean(arg));
|
|
23
|
+
}
|
|
24
|
+
main(...values) {
|
|
25
|
+
return values.reduce((a, b) => a || b);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=or.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"or.js","sourceRoot":"","sources":["../../../src/formula/functions/or.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAE1C,MAAM,OAAO,UAAW,SAAQ,YAAY;IAA5C;;QACE,YAAO,GAAG,gBAAgB,CAAC;QAC3B,aAAQ,GAAG;YACT,iDAAiD;YACjD,qDAAqD;SACtD,CAAC;QACF,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,aAAa,EAAE,WAAW,EAAE,2BAA2B,EAAE;YACjE;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,wBAAwB;gBACrC,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IASJ,CAAC;IAPW,QAAQ;QAChB,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IAES,IAAI,CAAC,GAAG,MAAiB;QACjC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACzC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/pi.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,SAAU;IACjB,QAAQ,WAAgC;IACxC,QAAQ,UAAM;IAEd,SAAS,CAAC,QAAQ;IASlB,SAAS,CAAC,IAAI;CAGf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
export class PiFunction extends BaseFunction {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.example = "PI()";
|
|
7
|
+
this.helpText = ["Returns the value of pi."];
|
|
8
|
+
this.helpArgs = [];
|
|
9
|
+
}
|
|
10
|
+
validate() {
|
|
11
|
+
if (this.bareArgs.length !== 0) {
|
|
12
|
+
throw new FormulaError("#N/A", "Number of arguments for PI is incorrect.");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
main() {
|
|
16
|
+
return Math.PI;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=pi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.js","sourceRoot":"","sources":["../../../src/formula/functions/pi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,OAAO,UAAW,SAAQ,YAAY;IAA5C;;QACE,YAAO,GAAG,MAAM,CAAC;QACjB,aAAQ,GAAG,CAAC,0BAA0B,CAAC,CAAC;QACxC,aAAQ,GAAG,EAAE,CAAC;IAchB,CAAC;IAZW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,0CAA0C,CAC3C,CAAC;SACH;IACH,CAAC;IAES,IAAI;QACZ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class PowerFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}[];
|
|
9
|
+
protected validate(): void;
|
|
10
|
+
protected main(base: number, exponent: number): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=power.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"power.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/power.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,SAAkB;IACzB,QAAQ,WAAmD;IAC3D,QAAQ;;;QAGN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;CAG9C"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class PowerFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "POWER(4,0.5)";
|
|
8
|
+
this.helpText = ["Returns a number multiplied by an exponent."];
|
|
9
|
+
this.helpArgs = [
|
|
10
|
+
{ name: "base", description: "A number to be multiplied by an exponent." },
|
|
11
|
+
{ name: "exponent", description: "An exponent to power the base." },
|
|
12
|
+
];
|
|
13
|
+
}
|
|
14
|
+
validate() {
|
|
15
|
+
if (this.bareArgs.length !== 2) {
|
|
16
|
+
throw new FormulaError("#N/A", "Number of arguments for POWER is incorrect.");
|
|
17
|
+
}
|
|
18
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
19
|
+
}
|
|
20
|
+
main(base, exponent) {
|
|
21
|
+
return Math.pow(base, exponent);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=power.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"power.js","sourceRoot":"","sources":["../../../src/formula/functions/power.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAA/C;;QACE,YAAO,GAAG,cAAc,CAAC;QACzB,aAAQ,GAAG,CAAC,6CAA6C,CAAC,CAAC;QAC3D,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,2CAA2C,EAAE;YAC1E,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,gCAAgC,EAAE;SACpE,CAAC;IAeJ,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,IAAY,EAAE,QAAgB;QAC3C,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAClC,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class ProductFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
optional?: undefined;
|
|
9
|
+
iterable?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
optional: boolean;
|
|
14
|
+
iterable: boolean;
|
|
15
|
+
})[];
|
|
16
|
+
protected validate(): void;
|
|
17
|
+
protected main(...values: number[]): number;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=product.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/product.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAAsB;IAC7B,QAAQ,WAA4D;IACpE,QAAQ;;;;;;;;;;SAQN;IAEF,SAAS,CAAC,QAAQ;IAgBlB,SAAS,CAAC,IAAI,CAAC,GAAG,MAAM,EAAE,MAAM,EAAE;CAGnC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { solveTable } from "../solver";
|
|
2
|
+
import { Table } from "../../lib/table";
|
|
3
|
+
import { BaseFunction } from "./__base";
|
|
4
|
+
import { ensureNumber } from "./__utils";
|
|
5
|
+
export class ProductFunction extends BaseFunction {
|
|
6
|
+
constructor() {
|
|
7
|
+
super(...arguments);
|
|
8
|
+
this.example = "PRODUCT(A2:A100)";
|
|
9
|
+
this.helpText = ["Returns the product of a series of numbers or cells."];
|
|
10
|
+
this.helpArgs = [
|
|
11
|
+
{ name: "value1", description: "First number or range." },
|
|
12
|
+
{
|
|
13
|
+
name: "value2",
|
|
14
|
+
description: "Additional numbers or ranges",
|
|
15
|
+
optional: true,
|
|
16
|
+
iterable: true,
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
}
|
|
20
|
+
validate() {
|
|
21
|
+
const spreaded = [];
|
|
22
|
+
this.bareArgs.forEach((arg) => {
|
|
23
|
+
if (arg instanceof Table) {
|
|
24
|
+
spreaded.push(...solveTable({ table: arg })
|
|
25
|
+
.reduce((a, b) => a.concat(b))
|
|
26
|
+
.filter((v) => typeof v === "number"));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
spreaded.push(ensureNumber(arg));
|
|
30
|
+
});
|
|
31
|
+
this.bareArgs = spreaded;
|
|
32
|
+
}
|
|
33
|
+
main(...values) {
|
|
34
|
+
return values.reduce((a, b) => a * b);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
//# sourceMappingURL=product.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/formula/functions/product.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAAjD;;QACE,YAAO,GAAG,kBAAkB,CAAC;QAC7B,aAAQ,GAAG,CAAC,sDAAsD,CAAC,CAAC;QACpE,aAAQ,GAAG;YACT,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;YACzD;gBACE,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE,8BAA8B;gBAC3C,QAAQ,EAAE,IAAI;gBACd,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAqBJ,CAAC;IAnBW,QAAQ;QAChB,MAAM,QAAQ,GAAa,EAAE,CAAC;QAC9B,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,EAAE;YAC5B,IAAI,GAAG,YAAY,KAAK,EAAE;gBACxB,QAAQ,CAAC,IAAI,CACX,GAAG,UAAU,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC;qBAC1B,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;qBAC7B,MAAM,CAAC,CAAC,CAAM,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAC7C,CAAC;gBACF,OAAO;aACR;YACD,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;QACH,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAES,IAAI,CAAC,GAAG,MAAgB;QAChC,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class RadiansFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}[];
|
|
9
|
+
protected validate(): void;
|
|
10
|
+
protected main(angle: number): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=radians.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radians.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/radians.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAAkB;IACzB,QAAQ,WAAkD;IAC1D,QAAQ;;;QAKN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class RadiansFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "RADIANS(180)";
|
|
8
|
+
this.helpText = ["Converts an angle from degrees to radians."];
|
|
9
|
+
this.helpArgs = [
|
|
10
|
+
{
|
|
11
|
+
name: "angle",
|
|
12
|
+
description: "The angle to convert from degrees to radians.",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.bareArgs.length !== 1) {
|
|
18
|
+
throw new FormulaError("#N/A", "Number of arguments for RADIANS is incorrect.");
|
|
19
|
+
}
|
|
20
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
+
}
|
|
22
|
+
main(angle) {
|
|
23
|
+
return (angle / 180) * Math.PI;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=radians.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"radians.js","sourceRoot":"","sources":["../../../src/formula/functions/radians.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAAjD;;QACE,YAAO,GAAG,cAAc,CAAC;QACzB,aAAQ,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAC1D,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,+CAA+C;aAC7D;SACF,CAAC;IAeJ,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,+CAA+C,CAChD,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rand.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/rand.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,SAAY;IACnB,QAAQ,WAAgD;IACxD,QAAQ,UAAM;IAEd,SAAS,CAAC,QAAQ;IASlB,SAAS,CAAC,IAAI;CAGf"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
export class RandFunction extends BaseFunction {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.example = "RAND()";
|
|
7
|
+
this.helpText = ["Returns a random number between 0 and 1."];
|
|
8
|
+
this.helpArgs = [];
|
|
9
|
+
}
|
|
10
|
+
validate() {
|
|
11
|
+
if (this.bareArgs.length !== 0) {
|
|
12
|
+
throw new FormulaError("#N/A", "Number of arguments for RAND is incorrect.");
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
main() {
|
|
16
|
+
return Math.random();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=rand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rand.js","sourceRoot":"","sources":["../../../src/formula/functions/rand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAA9C;;QACE,YAAO,GAAG,QAAQ,CAAC;QACnB,aAAQ,GAAG,CAAC,0CAA0C,CAAC,CAAC;QACxD,aAAQ,GAAG,EAAE,CAAC;IAchB,CAAC;IAZW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;IACH,CAAC;IAES,IAAI;QACZ,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class RoundFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
optional?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
optional: boolean;
|
|
13
|
+
})[];
|
|
14
|
+
protected validate(): void;
|
|
15
|
+
protected main(value: number, digit?: number): number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=round.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/round.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,aAAc,SAAQ,YAAY;IAC7C,OAAO,SAAoB;IAC3B,QAAQ,WAEN;IACF,QAAQ;;;;;;;;SAUN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI;CAIxC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class RoundFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "ROUND(99.44,1)";
|
|
8
|
+
this.helpText = [
|
|
9
|
+
"Round a number to the specified number of decimal places according to standard rules.",
|
|
10
|
+
];
|
|
11
|
+
this.helpArgs = [
|
|
12
|
+
{
|
|
13
|
+
name: "value",
|
|
14
|
+
description: "A number to be rounded.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "digit",
|
|
18
|
+
description: "The number of decimal places after rounding.",
|
|
19
|
+
optional: true,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
validate() {
|
|
24
|
+
if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
|
|
25
|
+
throw new FormulaError("#N/A", "Number of arguments for ROUND is incorrect.");
|
|
26
|
+
}
|
|
27
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
28
|
+
}
|
|
29
|
+
main(value, digit = 0) {
|
|
30
|
+
const multiplier = Math.pow(10, digit);
|
|
31
|
+
return Math.round(value * multiplier) / multiplier;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=round.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"round.js","sourceRoot":"","sources":["../../../src/formula/functions/round.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,aAAc,SAAQ,YAAY;IAA/C;;QACE,YAAO,GAAG,gBAAgB,CAAC;QAC3B,aAAQ,GAAG;YACT,uFAAuF;SACxF,CAAC;QACF,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,yBAAyB;aACvC;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAgBJ,CAAC;IAdW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5D,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class RounddownFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
optional?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
optional: boolean;
|
|
13
|
+
})[];
|
|
14
|
+
protected validate(): void;
|
|
15
|
+
protected main(value: number, digit?: number): number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=rounddown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rounddown.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/rounddown.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,iBAAkB,SAAQ,YAAY;IACjD,OAAO,SAAwB;IAC/B,QAAQ,WAEN;IACF,QAAQ;;;;;;;;SAUN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI;CAIxC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class RounddownFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "ROUNDDOWN(99.44,1)";
|
|
8
|
+
this.helpText = [
|
|
9
|
+
"Round down a number to the specified number of decimal places according to standard rules.",
|
|
10
|
+
];
|
|
11
|
+
this.helpArgs = [
|
|
12
|
+
{
|
|
13
|
+
name: "value",
|
|
14
|
+
description: "A number to be rounded down.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "digit",
|
|
18
|
+
description: "The number of decimal places after rounding.",
|
|
19
|
+
optional: true,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
validate() {
|
|
24
|
+
if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
|
|
25
|
+
throw new FormulaError("#N/A", "Number of arguments for ROUNDDOWN is incorrect.");
|
|
26
|
+
}
|
|
27
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
28
|
+
}
|
|
29
|
+
main(value, digit = 0) {
|
|
30
|
+
const multiplier = Math.pow(10, digit);
|
|
31
|
+
return Math.floor(value * multiplier) / multiplier;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=rounddown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rounddown.js","sourceRoot":"","sources":["../../../src/formula/functions/rounddown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,iBAAkB,SAAQ,YAAY;IAAnD;;QACE,YAAO,GAAG,oBAAoB,CAAC;QAC/B,aAAQ,GAAG;YACT,4FAA4F;SAC7F,CAAC;QACF,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8BAA8B;aAC5C;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAgBJ,CAAC;IAdW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5D,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,iDAAiD,CAClD,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;IACrD,CAAC;CACF"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class RoundupFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: ({
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
optional?: undefined;
|
|
9
|
+
} | {
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
optional: boolean;
|
|
13
|
+
})[];
|
|
14
|
+
protected validate(): void;
|
|
15
|
+
protected main(value: number, digit?: number): number;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=roundup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundup.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/roundup.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,eAAgB,SAAQ,YAAY;IAC/C,OAAO,SAAsB;IAC7B,QAAQ,WAEN;IACF,QAAQ;;;;;;;;SAUN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,SAAI;CAIxC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class RoundupFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "ROUNDUP(99.44,1)";
|
|
8
|
+
this.helpText = [
|
|
9
|
+
"Round up a number to the specified number of decimal places according to standard rules.",
|
|
10
|
+
];
|
|
11
|
+
this.helpArgs = [
|
|
12
|
+
{
|
|
13
|
+
name: "value",
|
|
14
|
+
description: "A number to be rounded up.",
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
name: "digit",
|
|
18
|
+
description: "The number of decimal places after rounding.",
|
|
19
|
+
optional: true,
|
|
20
|
+
},
|
|
21
|
+
];
|
|
22
|
+
}
|
|
23
|
+
validate() {
|
|
24
|
+
if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
|
|
25
|
+
throw new FormulaError("#N/A", "Number of arguments for ROUNDUP is incorrect.");
|
|
26
|
+
}
|
|
27
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
28
|
+
}
|
|
29
|
+
main(value, digit = 0) {
|
|
30
|
+
const multiplier = Math.pow(10, digit);
|
|
31
|
+
return Math.ceil(value * multiplier) / multiplier;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=roundup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roundup.js","sourceRoot":"","sources":["../../../src/formula/functions/roundup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,eAAgB,SAAQ,YAAY;IAAjD;;QACE,YAAO,GAAG,kBAAkB,CAAC;QAC7B,aAAQ,GAAG;YACT,0FAA0F;SAC3F,CAAC;QACF,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,4BAA4B;aAC1C;YACD;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,8CAA8C;gBAC3D,QAAQ,EAAE,IAAI;aACf;SACF,CAAC;IAgBJ,CAAC;IAdW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC5D,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,+CAA+C,CAChD,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;QACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;IACpD,CAAC;CACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Table } from "../../lib/table";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
export declare class RowFunction extends BaseFunction {
|
|
4
|
+
example: string;
|
|
5
|
+
helpText: string[];
|
|
6
|
+
helpArgs: {
|
|
7
|
+
name: string;
|
|
8
|
+
description: string;
|
|
9
|
+
option: boolean;
|
|
10
|
+
}[];
|
|
11
|
+
protected validate(): void;
|
|
12
|
+
protected main(trimmed: Table): number;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=row.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/row.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAExC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAa;IACpB,QAAQ,WAAmD;IAC3D,QAAQ;;;;QAMN;IAEF,SAAS,CAAC,QAAQ;IAYlB,SAAS,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK;CAG9B"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
export class RowFunction extends BaseFunction {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.example = "ROW(A9)";
|
|
7
|
+
this.helpText = ["Returns the row number of a specified cell."];
|
|
8
|
+
this.helpArgs = [
|
|
9
|
+
{
|
|
10
|
+
name: "cell_reference",
|
|
11
|
+
description: "The cell whose row number will be returned.",
|
|
12
|
+
option: true,
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.bareArgs.length === 0) {
|
|
18
|
+
this.bareArgs = [this.table];
|
|
19
|
+
}
|
|
20
|
+
else if (this.bareArgs.length === 1) {
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
throw new FormulaError("#N/A", "Number of arguments for ROW is incorrect.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
main(trimmed) {
|
|
27
|
+
return trimmed.top;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=row.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../../src/formula/functions/row.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,6CAA6C,CAAC,CAAC;QAC3D,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,gBAAgB;gBACtB,WAAW,EAAE,6CAA6C;gBAC1D,MAAM,EAAE,IAAI;aACb;SACF,CAAC;IAiBJ,CAAC;IAfW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;SAC9B;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;SACtC;aAAM;YACL,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,2CAA2C,CAC5C,CAAC;SACH;IACH,CAAC;IAES,IAAI,CAAC,OAAc;QAC3B,OAAO,OAAO,CAAC,GAAG,CAAC;IACrB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class SinFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}[];
|
|
9
|
+
protected validate(): void;
|
|
10
|
+
protected main(angle: number): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sin.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/sin.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,WAAY,SAAQ,YAAY;IAC3C,OAAO,SAAiB;IACxB,QAAQ,WAA0D;IAClE,QAAQ;;;QAKN;IAEF,SAAS,CAAC,QAAQ;IAUlB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class SinFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "SIN(PI()/2)";
|
|
8
|
+
this.helpText = ["Returns the sin of the angle specified in radians."];
|
|
9
|
+
this.helpArgs = [
|
|
10
|
+
{
|
|
11
|
+
name: "angle",
|
|
12
|
+
description: "An angle in radians, at which you want the sin.",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.bareArgs.length !== 1) {
|
|
18
|
+
throw new FormulaError("#N/A", "Number of arguments for SIN is incorrect.");
|
|
19
|
+
}
|
|
20
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
+
}
|
|
22
|
+
main(angle) {
|
|
23
|
+
return Math.sin(angle);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=sin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sin.js","sourceRoot":"","sources":["../../../src/formula/functions/sin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,WAAY,SAAQ,YAAY;IAA7C;;QACE,YAAO,GAAG,aAAa,CAAC;QACxB,aAAQ,GAAG,CAAC,oDAAoD,CAAC,CAAC;QAClE,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EAAE,iDAAiD;aAC/D;SACF,CAAC;IAeJ,CAAC;IAbW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,2CAA2C,CAC5C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;IAChE,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseFunction } from "./__base";
|
|
2
|
+
export declare class SqrtFunction extends BaseFunction {
|
|
3
|
+
example: string;
|
|
4
|
+
helpText: string[];
|
|
5
|
+
helpArgs: {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
}[];
|
|
9
|
+
protected validate(): void;
|
|
10
|
+
protected main(value: number): number;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=sqrt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqrt.d.ts","sourceRoot":"","sources":["../../../src/formula/functions/sqrt.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAGxC,qBAAa,YAAa,SAAQ,YAAY;IAC5C,OAAO,SAAa;IACpB,QAAQ,WAA8D;IACtE,QAAQ;;;QAMN;IAEF,SAAS,CAAC,QAAQ;IAalB,SAAS,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM;CAG7B"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FormulaError } from "../evaluator";
|
|
2
|
+
import { BaseFunction } from "./__base";
|
|
3
|
+
import { ensureNumber } from "./__utils";
|
|
4
|
+
export class SqrtFunction extends BaseFunction {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.example = "SQRT(9)";
|
|
8
|
+
this.helpText = ["Returns the positive square root of a positive number."];
|
|
9
|
+
this.helpArgs = [
|
|
10
|
+
{
|
|
11
|
+
name: "value",
|
|
12
|
+
description: "A number for which the positive square root is to be found.",
|
|
13
|
+
},
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
validate() {
|
|
17
|
+
if (this.bareArgs.length !== 1) {
|
|
18
|
+
throw new FormulaError("#N/A", "Number of arguments for SQRT is incorrect.");
|
|
19
|
+
}
|
|
20
|
+
this.bareArgs = this.bareArgs.map((arg) => ensureNumber(arg));
|
|
21
|
+
if (this.bareArgs[0] < 0) {
|
|
22
|
+
throw new FormulaError("NUM!", "First argument must be positive.");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
main(value) {
|
|
26
|
+
return Math.sqrt(value);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=sqrt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sqrt.js","sourceRoot":"","sources":["../../../src/formula/functions/sqrt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,MAAM,OAAO,YAAa,SAAQ,YAAY;IAA9C;;QACE,YAAO,GAAG,SAAS,CAAC;QACpB,aAAQ,GAAG,CAAC,wDAAwD,CAAC,CAAC;QACtE,aAAQ,GAAG;YACT;gBACE,IAAI,EAAE,OAAO;gBACb,WAAW,EACT,6DAA6D;aAChE;SACF,CAAC;IAkBJ,CAAC;IAhBW,QAAQ;QAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;YAC9B,MAAM,IAAI,YAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE;YACxB,MAAM,IAAI,YAAY,CAAC,MAAM,EAAE,kCAAkC,CAAC,CAAC;SACpE;IACH,CAAC;IAES,IAAI,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1B,CAAC;CACF"}
|