@gridsheet/react-core 0.12.4-rc.1 → 0.12.4

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.
Files changed (209) hide show
  1. package/dist/components/Cell.js +185 -197
  2. package/dist/components/Cell.js.map +1 -1
  3. package/dist/components/ContextMenu.js +198 -208
  4. package/dist/components/ContextMenu.js.map +1 -1
  5. package/dist/components/Editor.d.ts.map +1 -1
  6. package/dist/components/Editor.js +262 -275
  7. package/dist/components/Editor.js.map +1 -1
  8. package/dist/components/Emitter.js +29 -39
  9. package/dist/components/Emitter.js.map +1 -1
  10. package/dist/components/GridSheet.js +109 -119
  11. package/dist/components/GridSheet.js.map +1 -1
  12. package/dist/components/HeaderLeftCell.js +61 -72
  13. package/dist/components/HeaderLeftCell.js.map +1 -1
  14. package/dist/components/HeaderTopCell.js +62 -73
  15. package/dist/components/HeaderTopCell.js.map +1 -1
  16. package/dist/components/Resizer.js +79 -90
  17. package/dist/components/Resizer.js.map +1 -1
  18. package/dist/components/SearchBox.d.ts.map +1 -1
  19. package/dist/components/SearchBox.js +54 -64
  20. package/dist/components/SearchBox.js.map +1 -1
  21. package/dist/components/StoreInitializer.js +71 -81
  22. package/dist/components/StoreInitializer.js.map +1 -1
  23. package/dist/components/Tabular.d.ts +2 -2
  24. package/dist/components/Tabular.d.ts.map +1 -1
  25. package/dist/components/Tabular.js +85 -95
  26. package/dist/components/Tabular.js.map +1 -1
  27. package/dist/constants.js +26 -36
  28. package/dist/constants.js.map +1 -1
  29. package/dist/formula/evaluator.d.ts +1 -1
  30. package/dist/formula/evaluator.js +490 -500
  31. package/dist/formula/evaluator.js.map +1 -1
  32. package/dist/formula/functions/__base.js +17 -27
  33. package/dist/formula/functions/__base.js.map +1 -1
  34. package/dist/formula/functions/__utils.js +103 -113
  35. package/dist/formula/functions/__utils.js.map +1 -1
  36. package/dist/formula/functions/abs.js +21 -31
  37. package/dist/formula/functions/abs.js.map +1 -1
  38. package/dist/formula/functions/abs.spec.js +25 -35
  39. package/dist/formula/functions/abs.spec.js.map +1 -1
  40. package/dist/formula/functions/acos.js +28 -38
  41. package/dist/formula/functions/acos.js.map +1 -1
  42. package/dist/formula/functions/add.js +47 -57
  43. package/dist/formula/functions/add.js.map +1 -1
  44. package/dist/formula/functions/and.js +28 -38
  45. package/dist/formula/functions/and.js.map +1 -1
  46. package/dist/formula/functions/asin.js +28 -38
  47. package/dist/formula/functions/asin.js.map +1 -1
  48. package/dist/formula/functions/atan.js +26 -36
  49. package/dist/formula/functions/atan.js.map +1 -1
  50. package/dist/formula/functions/atan2.js +32 -42
  51. package/dist/formula/functions/atan2.js.map +1 -1
  52. package/dist/formula/functions/average.js +40 -50
  53. package/dist/formula/functions/average.js.map +1 -1
  54. package/dist/formula/functions/col.js +28 -38
  55. package/dist/formula/functions/col.js.map +1 -1
  56. package/dist/formula/functions/concat.js +27 -37
  57. package/dist/formula/functions/concat.js.map +1 -1
  58. package/dist/formula/functions/concatenate.js +25 -35
  59. package/dist/formula/functions/concatenate.js.map +1 -1
  60. package/dist/formula/functions/cos.js +26 -36
  61. package/dist/formula/functions/cos.js.map +1 -1
  62. package/dist/formula/functions/count.js +35 -45
  63. package/dist/formula/functions/count.js.map +1 -1
  64. package/dist/formula/functions/counta.js +35 -45
  65. package/dist/formula/functions/counta.js.map +1 -1
  66. package/dist/formula/functions/countif.js +30 -40
  67. package/dist/formula/functions/countif.js.map +1 -1
  68. package/dist/formula/functions/divide.js +32 -42
  69. package/dist/formula/functions/divide.js.map +1 -1
  70. package/dist/formula/functions/eq.js +25 -35
  71. package/dist/formula/functions/eq.js.map +1 -1
  72. package/dist/formula/functions/exp.js +28 -38
  73. package/dist/formula/functions/exp.js.map +1 -1
  74. package/dist/formula/functions/gt.js +27 -37
  75. package/dist/formula/functions/gt.js.map +1 -1
  76. package/dist/formula/functions/gte.js +27 -37
  77. package/dist/formula/functions/gte.js.map +1 -1
  78. package/dist/formula/functions/hlookup.js +67 -77
  79. package/dist/formula/functions/hlookup.js.map +1 -1
  80. package/dist/formula/functions/if.js +36 -46
  81. package/dist/formula/functions/if.js.map +1 -1
  82. package/dist/formula/functions/iferror.js +38 -48
  83. package/dist/formula/functions/iferror.js.map +1 -1
  84. package/dist/formula/functions/iferror.spec.js +53 -63
  85. package/dist/formula/functions/iferror.spec.js.map +1 -1
  86. package/dist/formula/functions/len.js +26 -36
  87. package/dist/formula/functions/len.js.map +1 -1
  88. package/dist/formula/functions/lenb.js +26 -36
  89. package/dist/formula/functions/lenb.js.map +1 -1
  90. package/dist/formula/functions/ln.js +28 -38
  91. package/dist/formula/functions/ln.js.map +1 -1
  92. package/dist/formula/functions/log.js +33 -43
  93. package/dist/formula/functions/log.js.map +1 -1
  94. package/dist/formula/functions/log10.js +28 -38
  95. package/dist/formula/functions/log10.js.map +1 -1
  96. package/dist/formula/functions/lt.js +27 -37
  97. package/dist/formula/functions/lt.js.map +1 -1
  98. package/dist/formula/functions/lte.js +27 -37
  99. package/dist/formula/functions/lte.js.map +1 -1
  100. package/dist/formula/functions/max.js +42 -52
  101. package/dist/formula/functions/max.js.map +1 -1
  102. package/dist/formula/functions/min.js +42 -52
  103. package/dist/formula/functions/min.js.map +1 -1
  104. package/dist/formula/functions/minus.js +47 -57
  105. package/dist/formula/functions/minus.js.map +1 -1
  106. package/dist/formula/functions/mod.js +30 -40
  107. package/dist/formula/functions/mod.js.map +1 -1
  108. package/dist/formula/functions/mod.spec.js +47 -57
  109. package/dist/formula/functions/mod.spec.js.map +1 -1
  110. package/dist/formula/functions/multiply.js +27 -37
  111. package/dist/formula/functions/multiply.js.map +1 -1
  112. package/dist/formula/functions/ne.js +25 -35
  113. package/dist/formula/functions/ne.js.map +1 -1
  114. package/dist/formula/functions/not.js +30 -40
  115. package/dist/formula/functions/not.js.map +1 -1
  116. package/dist/formula/functions/now.js +21 -31
  117. package/dist/formula/functions/now.js.map +1 -1
  118. package/dist/formula/functions/or.js +28 -38
  119. package/dist/formula/functions/or.js.map +1 -1
  120. package/dist/formula/functions/pi.js +19 -29
  121. package/dist/formula/functions/pi.js.map +1 -1
  122. package/dist/formula/functions/power.js +24 -34
  123. package/dist/formula/functions/power.js.map +1 -1
  124. package/dist/formula/functions/product.js +37 -47
  125. package/dist/formula/functions/product.js.map +1 -1
  126. package/dist/formula/functions/radians.js +26 -36
  127. package/dist/formula/functions/radians.js.map +1 -1
  128. package/dist/formula/functions/rand.js +19 -29
  129. package/dist/formula/functions/rand.js.map +1 -1
  130. package/dist/formula/functions/round.js +34 -44
  131. package/dist/formula/functions/round.js.map +1 -1
  132. package/dist/formula/functions/rounddown.js +34 -44
  133. package/dist/formula/functions/rounddown.js.map +1 -1
  134. package/dist/formula/functions/roundup.js +34 -44
  135. package/dist/formula/functions/roundup.js.map +1 -1
  136. package/dist/formula/functions/row.js +28 -38
  137. package/dist/formula/functions/row.js.map +1 -1
  138. package/dist/formula/functions/sin.js +26 -36
  139. package/dist/formula/functions/sin.js.map +1 -1
  140. package/dist/formula/functions/sqrt.js +28 -38
  141. package/dist/formula/functions/sqrt.js.map +1 -1
  142. package/dist/formula/functions/sum.js +42 -52
  143. package/dist/formula/functions/sum.js.map +1 -1
  144. package/dist/formula/functions/sum.spec.js +35 -45
  145. package/dist/formula/functions/sum.spec.js.map +1 -1
  146. package/dist/formula/functions/sumif.js +56 -66
  147. package/dist/formula/functions/sumif.js.map +1 -1
  148. package/dist/formula/functions/tan.js +26 -36
  149. package/dist/formula/functions/tan.js.map +1 -1
  150. package/dist/formula/functions/uminus.js +23 -33
  151. package/dist/formula/functions/uminus.js.map +1 -1
  152. package/dist/formula/functions/vlookup.js +67 -77
  153. package/dist/formula/functions/vlookup.js.map +1 -1
  154. package/dist/formula/mapping.js +116 -126
  155. package/dist/formula/mapping.js.map +1 -1
  156. package/dist/formula/solver.js +61 -71
  157. package/dist/formula/solver.js.map +1 -1
  158. package/dist/index.js +31 -41
  159. package/dist/index.js.map +1 -1
  160. package/dist/lib/autofill.js +334 -344
  161. package/dist/lib/autofill.js.map +1 -1
  162. package/dist/lib/clipboard.js +45 -55
  163. package/dist/lib/clipboard.js.map +1 -1
  164. package/dist/lib/converters.js +130 -140
  165. package/dist/lib/converters.js.map +1 -1
  166. package/dist/lib/hooks.d.ts +1 -0
  167. package/dist/lib/hooks.d.ts.map +1 -0
  168. package/dist/lib/hooks.js +2 -0
  169. package/dist/lib/hooks.js.map +1 -0
  170. package/dist/lib/structs.js +254 -264
  171. package/dist/lib/structs.js.map +1 -1
  172. package/dist/lib/table.d.ts +1 -3
  173. package/dist/lib/table.d.ts.map +1 -1
  174. package/dist/lib/table.js +897 -911
  175. package/dist/lib/table.js.map +1 -1
  176. package/dist/lib/time.d.ts.map +1 -1
  177. package/dist/lib/time.js +59 -69
  178. package/dist/lib/time.js.map +1 -1
  179. package/dist/lib/virtualization.d.ts +3 -21
  180. package/dist/lib/virtualization.d.ts.map +1 -1
  181. package/dist/lib/virtualization.js +115 -125
  182. package/dist/lib/virtualization.js.map +1 -1
  183. package/dist/parsers/core.js +109 -119
  184. package/dist/parsers/core.js.map +1 -1
  185. package/dist/renderers/checkbox.js +11 -21
  186. package/dist/renderers/checkbox.js.map +1 -1
  187. package/dist/renderers/core.d.ts +1 -1
  188. package/dist/renderers/core.d.ts.map +1 -1
  189. package/dist/renderers/core.js +129 -139
  190. package/dist/renderers/core.js.map +1 -1
  191. package/dist/renderers/thousand_separator.js +15 -25
  192. package/dist/renderers/thousand_separator.js.map +1 -1
  193. package/dist/store/actions.d.ts.map +1 -1
  194. package/dist/store/actions.js +484 -498
  195. package/dist/store/actions.js.map +1 -1
  196. package/dist/store/helpers.js +78 -88
  197. package/dist/store/helpers.js.map +1 -1
  198. package/dist/store/index.js +5 -15
  199. package/dist/store/index.js.map +1 -1
  200. package/dist/styles/embedder.js +17 -27
  201. package/dist/styles/embedder.js.map +1 -1
  202. package/dist/styles/minified.js +6 -16
  203. package/dist/styles/minified.js.map +1 -1
  204. package/dist/types.d.ts +6 -1
  205. package/dist/types.d.ts.map +1 -1
  206. package/dist/types.js +2 -12
  207. package/dist/utils.js +9 -19
  208. package/dist/utils.js.map +1 -1
  209. package/package.json +9 -2
@@ -1,33 +1,23 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PiFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ class PiFunction extends __base_1.BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = "PI()";
10
+ this.helpText = ["Returns the value of pi."];
11
+ this.helpArgs = [];
5
12
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PiFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- class PiFunction extends __base_1.BaseFunction {
16
- constructor() {
17
- super(...arguments);
18
- this.example = "PI()";
19
- this.helpText = ["Returns the value of pi."];
20
- this.helpArgs = [];
21
- }
22
- validate() {
23
- if (this.bareArgs.length !== 0) {
24
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for PI is incorrect.");
25
- }
26
- }
27
- main() {
28
- return Math.PI;
13
+ validate() {
14
+ if (this.bareArgs.length !== 0) {
15
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for PI is incorrect.");
29
16
  }
30
17
  }
31
- exports.PiFunction = PiFunction;
32
- });
18
+ main() {
19
+ return Math.PI;
20
+ }
21
+ }
22
+ exports.PiFunction = PiFunction;
33
23
  //# sourceMappingURL=pi.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pi.js","sourceRoot":"","sources":["../../../src/formula/functions/pi.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IAExC,MAAa,UAAW,SAAQ,qBAAY;QAA5C;;YACE,YAAO,GAAG,MAAM,CAAC;YACjB,aAAQ,GAAG,CAAC,0BAA0B,CAAC,CAAC;YACxC,aAAQ,GAAG,EAAE,CAAC;QAchB,CAAC;QAZW,QAAQ;YAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC9B,MAAM,IAAI,wBAAY,CACpB,MAAM,EACN,0CAA0C,CAC3C,CAAC;aACH;QACH,CAAC;QAES,IAAI;YACZ,OAAO,IAAI,CAAC,EAAE,CAAC;QACjB,CAAC;KACF;IAjBD,gCAiBC"}
1
+ {"version":3,"file":"pi.js","sourceRoot":"","sources":["../../../src/formula/functions/pi.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,qCAAwC;AAExC,MAAa,UAAW,SAAQ,qBAAY;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,wBAAY,CACpB,MAAM,EACN,0CAA0C,CAC3C,CAAC;SACH;IACH,CAAC;IAES,IAAI;QACZ,OAAO,IAAI,CAAC,EAAE,CAAC;IACjB,CAAC;CACF;AAjBD,gCAiBC"}
@@ -1,38 +1,28 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PowerFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ const __utils_1 = require("./__utils");
7
+ class PowerFunction extends __base_1.BaseFunction {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.example = "POWER(4,0.5)";
11
+ this.helpText = ["Returns a number multiplied by an exponent."];
12
+ this.helpArgs = [
13
+ { name: "base", description: "A number to be multiplied by an exponent." },
14
+ { name: "exponent", description: "An exponent to power the base." },
15
+ ];
5
16
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base", "./__utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.PowerFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- const __utils_1 = require("./__utils");
16
- class PowerFunction extends __base_1.BaseFunction {
17
- constructor() {
18
- super(...arguments);
19
- this.example = "POWER(4,0.5)";
20
- this.helpText = ["Returns a number multiplied by an exponent."];
21
- this.helpArgs = [
22
- { name: "base", description: "A number to be multiplied by an exponent." },
23
- { name: "exponent", description: "An exponent to power the base." },
24
- ];
25
- }
26
- validate() {
27
- if (this.bareArgs.length !== 2) {
28
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for POWER is incorrect.");
29
- }
30
- this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
31
- }
32
- main(base, exponent) {
33
- return Math.pow(base, exponent);
17
+ validate() {
18
+ if (this.bareArgs.length !== 2) {
19
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for POWER is incorrect.");
34
20
  }
21
+ this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
22
+ }
23
+ main(base, exponent) {
24
+ return Math.pow(base, exponent);
35
25
  }
36
- exports.PowerFunction = PowerFunction;
37
- });
26
+ }
27
+ exports.PowerFunction = PowerFunction;
38
28
  //# sourceMappingURL=power.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"power.js","sourceRoot":"","sources":["../../../src/formula/functions/power.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IACxC,uCAAyC;IAEzC,MAAa,aAAc,SAAQ,qBAAY;QAA/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;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,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;AArBD,sCAqBC"}
@@ -1,51 +1,41 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ProductFunction = void 0;
4
+ const solver_1 = require("../solver");
5
+ const table_1 = require("../../lib/table");
6
+ const __base_1 = require("./__base");
7
+ const __utils_1 = require("./__utils");
8
+ class ProductFunction extends __base_1.BaseFunction {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.example = "PRODUCT(A2:A100)";
12
+ this.helpText = ["Returns the product of a series of numbers or cells."];
13
+ this.helpArgs = [
14
+ { name: "value1", description: "First number or range." },
15
+ {
16
+ name: "value2",
17
+ description: "Additional numbers or ranges",
18
+ optional: true,
19
+ iterable: true,
20
+ },
21
+ ];
5
22
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../solver", "../../lib/table", "./__base", "./__utils"], factory);
23
+ validate() {
24
+ const spreaded = [];
25
+ this.bareArgs.forEach((arg) => {
26
+ if (arg instanceof table_1.Table) {
27
+ spreaded.push(...(0, solver_1.solveTable)({ table: arg })
28
+ .reduce((a, b) => a.concat(b))
29
+ .filter((v) => typeof v === "number"));
30
+ return;
31
+ }
32
+ spreaded.push((0, __utils_1.ensureNumber)(arg));
33
+ });
34
+ this.bareArgs = spreaded;
8
35
  }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.ProductFunction = void 0;
13
- const solver_1 = require("../solver");
14
- const table_1 = require("../../lib/table");
15
- const __base_1 = require("./__base");
16
- const __utils_1 = require("./__utils");
17
- class ProductFunction extends __base_1.BaseFunction {
18
- constructor() {
19
- super(...arguments);
20
- this.example = "PRODUCT(A2:A100)";
21
- this.helpText = ["Returns the product of a series of numbers or cells."];
22
- this.helpArgs = [
23
- { name: "value1", description: "First number or range." },
24
- {
25
- name: "value2",
26
- description: "Additional numbers or ranges",
27
- optional: true,
28
- iterable: true,
29
- },
30
- ];
31
- }
32
- validate() {
33
- const spreaded = [];
34
- this.bareArgs.forEach((arg) => {
35
- if (arg instanceof table_1.Table) {
36
- spreaded.push(...(0, solver_1.solveTable)({ table: arg })
37
- .reduce((a, b) => a.concat(b))
38
- .filter((v) => typeof v === "number"));
39
- return;
40
- }
41
- spreaded.push((0, __utils_1.ensureNumber)(arg));
42
- });
43
- this.bareArgs = spreaded;
44
- }
45
- main(...values) {
46
- return values.reduce((a, b) => a * b);
47
- }
36
+ main(...values) {
37
+ return values.reduce((a, b) => a * b);
48
38
  }
49
- exports.ProductFunction = ProductFunction;
50
- });
39
+ }
40
+ exports.ProductFunction = ProductFunction;
51
41
  //# sourceMappingURL=product.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.js","sourceRoot":"","sources":["../../../src/formula/functions/product.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,sCAAuC;IACvC,2CAAwC;IACxC,qCAAwC;IACxC,uCAAyC;IAEzC,MAAa,eAAgB,SAAQ,qBAAY;QAAjD;;YACE,YAAO,GAAG,kBAAkB,CAAC;YAC7B,aAAQ,GAAG,CAAC,sDAAsD,CAAC,CAAC;YACpE,aAAQ,GAAG;gBACT,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,wBAAwB,EAAE;gBACzD;oBACE,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;oBAC3C,QAAQ,EAAE,IAAI;oBACd,QAAQ,EAAE,IAAI;iBACf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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,aAAK,EAAE;gBACxB,QAAQ,CAAC,IAAI,CACX,GAAG,IAAA,mBAAU,EAAC,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,IAAA,sBAAY,EAAC,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;AAhCD,0CAgCC"}
@@ -1,40 +1,30 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RadiansFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ const __utils_1 = require("./__utils");
7
+ class RadiansFunction extends __base_1.BaseFunction {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.example = "RADIANS(180)";
11
+ this.helpText = ["Converts an angle from degrees to radians."];
12
+ this.helpArgs = [
13
+ {
14
+ name: "angle",
15
+ description: "The angle to convert from degrees to radians.",
16
+ },
17
+ ];
5
18
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base", "./__utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RadiansFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- const __utils_1 = require("./__utils");
16
- class RadiansFunction extends __base_1.BaseFunction {
17
- constructor() {
18
- super(...arguments);
19
- this.example = "RADIANS(180)";
20
- this.helpText = ["Converts an angle from degrees to radians."];
21
- this.helpArgs = [
22
- {
23
- name: "angle",
24
- description: "The angle to convert from degrees to radians.",
25
- },
26
- ];
27
- }
28
- validate() {
29
- if (this.bareArgs.length !== 1) {
30
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for RADIANS is incorrect.");
31
- }
32
- this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
33
- }
34
- main(angle) {
35
- return (angle / 180) * Math.PI;
19
+ validate() {
20
+ if (this.bareArgs.length !== 1) {
21
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for RADIANS is incorrect.");
36
22
  }
23
+ this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
24
+ }
25
+ main(angle) {
26
+ return (angle / 180) * Math.PI;
37
27
  }
38
- exports.RadiansFunction = RadiansFunction;
39
- });
28
+ }
29
+ exports.RadiansFunction = RadiansFunction;
40
30
  //# sourceMappingURL=radians.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"radians.js","sourceRoot":"","sources":["../../../src/formula/functions/radians.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IACxC,uCAAyC;IAEzC,MAAa,eAAgB,SAAQ,qBAAY;QAAjD;;YACE,YAAO,GAAG,cAAc,CAAC;YACzB,aAAQ,GAAG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C1B,OAAO,CAAC,KAAK,GAAG,GAAG,CAAC,GAAG,IAAI,CAAC,EAAE,CAAC;IACjC,CAAC;CACF;AAvBD,0CAuBC"}
@@ -1,33 +1,23 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RandFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ class RandFunction extends __base_1.BaseFunction {
7
+ constructor() {
8
+ super(...arguments);
9
+ this.example = "RAND()";
10
+ this.helpText = ["Returns a random number between 0 and 1."];
11
+ this.helpArgs = [];
5
12
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RandFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- class RandFunction extends __base_1.BaseFunction {
16
- constructor() {
17
- super(...arguments);
18
- this.example = "RAND()";
19
- this.helpText = ["Returns a random number between 0 and 1."];
20
- this.helpArgs = [];
21
- }
22
- validate() {
23
- if (this.bareArgs.length !== 0) {
24
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for RAND is incorrect.");
25
- }
26
- }
27
- main() {
28
- return Math.random();
13
+ validate() {
14
+ if (this.bareArgs.length !== 0) {
15
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for RAND is incorrect.");
29
16
  }
30
17
  }
31
- exports.RandFunction = RandFunction;
32
- });
18
+ main() {
19
+ return Math.random();
20
+ }
21
+ }
22
+ exports.RandFunction = RandFunction;
33
23
  //# sourceMappingURL=rand.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rand.js","sourceRoot":"","sources":["../../../src/formula/functions/rand.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IAExC,MAAa,YAAa,SAAQ,qBAAY;QAA9C;;YACE,YAAO,GAAG,QAAQ,CAAC;YACnB,aAAQ,GAAG,CAAC,0CAA0C,CAAC,CAAC;YACxD,aAAQ,GAAG,EAAE,CAAC;QAchB,CAAC;QAZW,QAAQ;YAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC9B,MAAM,IAAI,wBAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;aACH;QACH,CAAC;QAES,IAAI;YACZ,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;QACvB,CAAC;KACF;IAjBD,oCAiBC"}
1
+ {"version":3,"file":"rand.js","sourceRoot":"","sources":["../../../src/formula/functions/rand.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,qCAAwC;AAExC,MAAa,YAAa,SAAQ,qBAAY;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,wBAAY,CACpB,MAAM,EACN,4CAA4C,CAC7C,CAAC;SACH;IACH,CAAC;IAES,IAAI;QACZ,OAAO,IAAI,CAAC,MAAM,EAAE,CAAC;IACvB,CAAC;CACF;AAjBD,oCAiBC"}
@@ -1,48 +1,38 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoundFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ const __utils_1 = require("./__utils");
7
+ class RoundFunction extends __base_1.BaseFunction {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.example = "ROUND(99.44,1)";
11
+ this.helpText = [
12
+ "Round a number to the specified number of decimal places according to standard rules.",
13
+ ];
14
+ this.helpArgs = [
15
+ {
16
+ name: "value",
17
+ description: "A number to be rounded.",
18
+ },
19
+ {
20
+ name: "digit",
21
+ description: "The number of decimal places after rounding.",
22
+ optional: true,
23
+ },
24
+ ];
5
25
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base", "./__utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RoundFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- const __utils_1 = require("./__utils");
16
- class RoundFunction extends __base_1.BaseFunction {
17
- constructor() {
18
- super(...arguments);
19
- this.example = "ROUND(99.44,1)";
20
- this.helpText = [
21
- "Round a number to the specified number of decimal places according to standard rules.",
22
- ];
23
- this.helpArgs = [
24
- {
25
- name: "value",
26
- description: "A number to be rounded.",
27
- },
28
- {
29
- name: "digit",
30
- description: "The number of decimal places after rounding.",
31
- optional: true,
32
- },
33
- ];
34
- }
35
- validate() {
36
- if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
37
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUND is incorrect.");
38
- }
39
- this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
40
- }
41
- main(value, digit = 0) {
42
- const multiplier = Math.pow(10, digit);
43
- return Math.round(value * multiplier) / multiplier;
26
+ validate() {
27
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
28
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUND is incorrect.");
44
29
  }
30
+ this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
31
+ }
32
+ main(value, digit = 0) {
33
+ const multiplier = Math.pow(10, digit);
34
+ return Math.round(value * multiplier) / multiplier;
45
35
  }
46
- exports.RoundFunction = RoundFunction;
47
- });
36
+ }
37
+ exports.RoundFunction = RoundFunction;
48
38
  //# sourceMappingURL=round.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"round.js","sourceRoot":"","sources":["../../../src/formula/functions/round.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IACxC,uCAAyC;IAEzC,MAAa,aAAc,SAAQ,qBAAY;QAA/C;;YACE,YAAO,GAAG,gBAAgB,CAAC;YAC3B,aAAQ,GAAG;gBACT,uFAAuF;aACxF,CAAC;YACF,aAAQ,GAAG;gBACT;oBACE,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,yBAAyB;iBACvC;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,8CAA8C;oBAC3D,QAAQ,EAAE,IAAI;iBACf;aACF,CAAC;QAgBJ,CAAC;QAdW,QAAQ;YAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5D,MAAM,IAAI,wBAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;aACH;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC;QAES,IAAI,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;YACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;QACrD,CAAC;KACF;IA/BD,sCA+BC"}
1
+ {"version":3,"file":"round.js","sourceRoot":"","sources":["../../../src/formula/functions/round.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,qCAAwC;AACxC,uCAAyC;AAEzC,MAAa,aAAc,SAAQ,qBAAY;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,wBAAY,CACpB,MAAM,EACN,6CAA6C,CAC9C,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,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;AA/BD,sCA+BC"}
@@ -1,48 +1,38 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RounddownFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ const __utils_1 = require("./__utils");
7
+ class RounddownFunction extends __base_1.BaseFunction {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.example = "ROUNDDOWN(99.44,1)";
11
+ this.helpText = [
12
+ "Round down a number to the specified number of decimal places according to standard rules.",
13
+ ];
14
+ this.helpArgs = [
15
+ {
16
+ name: "value",
17
+ description: "A number to be rounded down.",
18
+ },
19
+ {
20
+ name: "digit",
21
+ description: "The number of decimal places after rounding.",
22
+ optional: true,
23
+ },
24
+ ];
5
25
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base", "./__utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RounddownFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- const __utils_1 = require("./__utils");
16
- class RounddownFunction extends __base_1.BaseFunction {
17
- constructor() {
18
- super(...arguments);
19
- this.example = "ROUNDDOWN(99.44,1)";
20
- this.helpText = [
21
- "Round down a number to the specified number of decimal places according to standard rules.",
22
- ];
23
- this.helpArgs = [
24
- {
25
- name: "value",
26
- description: "A number to be rounded down.",
27
- },
28
- {
29
- name: "digit",
30
- description: "The number of decimal places after rounding.",
31
- optional: true,
32
- },
33
- ];
34
- }
35
- validate() {
36
- if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
37
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUNDDOWN is incorrect.");
38
- }
39
- this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
40
- }
41
- main(value, digit = 0) {
42
- const multiplier = Math.pow(10, digit);
43
- return Math.floor(value * multiplier) / multiplier;
26
+ validate() {
27
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
28
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUNDDOWN is incorrect.");
44
29
  }
30
+ this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
31
+ }
32
+ main(value, digit = 0) {
33
+ const multiplier = Math.pow(10, digit);
34
+ return Math.floor(value * multiplier) / multiplier;
45
35
  }
46
- exports.RounddownFunction = RounddownFunction;
47
- });
36
+ }
37
+ exports.RounddownFunction = RounddownFunction;
48
38
  //# sourceMappingURL=rounddown.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rounddown.js","sourceRoot":"","sources":["../../../src/formula/functions/rounddown.ts"],"names":[],"mappings":";;;;;;;;;;;;IAAA,4CAA4C;IAC5C,qCAAwC;IACxC,uCAAyC;IAEzC,MAAa,iBAAkB,SAAQ,qBAAY;QAAnD;;YACE,YAAO,GAAG,oBAAoB,CAAC;YAC/B,aAAQ,GAAG;gBACT,4FAA4F;aAC7F,CAAC;YACF,aAAQ,GAAG;gBACT;oBACE,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,8BAA8B;iBAC5C;gBACD;oBACE,IAAI,EAAE,OAAO;oBACb,WAAW,EAAE,8CAA8C;oBAC3D,QAAQ,EAAE,IAAI;iBACf;aACF,CAAC;QAgBJ,CAAC;QAdW,QAAQ;YAChB,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;gBAC5D,MAAM,IAAI,wBAAY,CACpB,MAAM,EACN,iDAAiD,CAClD,CAAC;aACH;YACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,GAAG,CAAC,CAAC,CAAC;QAChE,CAAC;QAES,IAAI,CAAC,KAAa,EAAE,KAAK,GAAG,CAAC;YACrC,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,UAAU,CAAC,GAAG,UAAU,CAAC;QACrD,CAAC;KACF;IA/BD,8CA+BC"}
1
+ {"version":3,"file":"rounddown.js","sourceRoot":"","sources":["../../../src/formula/functions/rounddown.ts"],"names":[],"mappings":";;;AAAA,4CAA4C;AAC5C,qCAAwC;AACxC,uCAAyC;AAEzC,MAAa,iBAAkB,SAAQ,qBAAY;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,wBAAY,CACpB,MAAM,EACN,iDAAiD,CAClD,CAAC;SACH;QACD,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAA,sBAAY,EAAC,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;AA/BD,8CA+BC"}
@@ -1,48 +1,38 @@
1
- (function (factory) {
2
- if (typeof module === "object" && typeof module.exports === "object") {
3
- var v = factory(require, exports);
4
- if (v !== undefined) module.exports = v;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.RoundupFunction = void 0;
4
+ const evaluator_1 = require("../evaluator");
5
+ const __base_1 = require("./__base");
6
+ const __utils_1 = require("./__utils");
7
+ class RoundupFunction extends __base_1.BaseFunction {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.example = "ROUNDUP(99.44,1)";
11
+ this.helpText = [
12
+ "Round up a number to the specified number of decimal places according to standard rules.",
13
+ ];
14
+ this.helpArgs = [
15
+ {
16
+ name: "value",
17
+ description: "A number to be rounded up.",
18
+ },
19
+ {
20
+ name: "digit",
21
+ description: "The number of decimal places after rounding.",
22
+ optional: true,
23
+ },
24
+ ];
5
25
  }
6
- else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "../evaluator", "./__base", "./__utils"], factory);
8
- }
9
- })(function (require, exports) {
10
- "use strict";
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.RoundupFunction = void 0;
13
- const evaluator_1 = require("../evaluator");
14
- const __base_1 = require("./__base");
15
- const __utils_1 = require("./__utils");
16
- class RoundupFunction extends __base_1.BaseFunction {
17
- constructor() {
18
- super(...arguments);
19
- this.example = "ROUNDUP(99.44,1)";
20
- this.helpText = [
21
- "Round up a number to the specified number of decimal places according to standard rules.",
22
- ];
23
- this.helpArgs = [
24
- {
25
- name: "value",
26
- description: "A number to be rounded up.",
27
- },
28
- {
29
- name: "digit",
30
- description: "The number of decimal places after rounding.",
31
- optional: true,
32
- },
33
- ];
34
- }
35
- validate() {
36
- if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
37
- throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUNDUP is incorrect.");
38
- }
39
- this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
40
- }
41
- main(value, digit = 0) {
42
- const multiplier = Math.pow(10, digit);
43
- return Math.ceil(value * multiplier) / multiplier;
26
+ validate() {
27
+ if (this.bareArgs.length !== 1 && this.bareArgs.length !== 2) {
28
+ throw new evaluator_1.FormulaError("#N/A", "Number of arguments for ROUNDUP is incorrect.");
44
29
  }
30
+ this.bareArgs = this.bareArgs.map((arg) => (0, __utils_1.ensureNumber)(arg));
31
+ }
32
+ main(value, digit = 0) {
33
+ const multiplier = Math.pow(10, digit);
34
+ return Math.ceil(value * multiplier) / multiplier;
45
35
  }
46
- exports.RoundupFunction = RoundupFunction;
47
- });
36
+ }
37
+ exports.RoundupFunction = RoundupFunction;
48
38
  //# sourceMappingURL=roundup.js.map