@syncfusion/ej2-calculate 35.1.37

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 (173) hide show
  1. package/.eslintrc.json +263 -0
  2. package/README.md +132 -0
  3. package/base.d.ts +4 -0
  4. package/base.js +4 -0
  5. package/common.d.ts +4 -0
  6. package/common.js +4 -0
  7. package/dist/ej2-calculate.umd.min.js +11 -0
  8. package/dist/ej2-calculate.umd.min.js.map +1 -0
  9. package/dist/es6/ej2-calculate.es2015.js +24801 -0
  10. package/dist/es6/ej2-calculate.es2015.js.map +1 -0
  11. package/dist/es6/ej2-calculate.es5.js +27229 -0
  12. package/dist/es6/ej2-calculate.es5.js.map +1 -0
  13. package/dist/global/ej2-calculate.min.js +11 -0
  14. package/dist/global/ej2-calculate.min.js.map +1 -0
  15. package/dist/global/index.d.ts +14 -0
  16. package/formulas.d.ts +4 -0
  17. package/formulas.js +4 -0
  18. package/index.d.ts +4 -0
  19. package/index.js +4 -0
  20. package/license +10 -0
  21. package/package.json +30 -0
  22. package/src/base/calculate-model.d.ts +4 -0
  23. package/src/base/calculate-model.js +0 -0
  24. package/src/base/calculate.d.ts +1105 -0
  25. package/src/base/calculate.js +4720 -0
  26. package/src/base/index.d.ts +8 -0
  27. package/src/base/index.js +7 -0
  28. package/src/base/parser.d.ts +208 -0
  29. package/src/base/parser.js +1512 -0
  30. package/src/common/address.d.ts +59 -0
  31. package/src/common/address.js +96 -0
  32. package/src/common/cell-ref.d.ts +32 -0
  33. package/src/common/cell-ref.js +112 -0
  34. package/src/common/common.d.ts +44 -0
  35. package/src/common/common.js +134 -0
  36. package/src/common/enum.d.ts +94 -0
  37. package/src/common/enum.js +97 -0
  38. package/src/common/index.d.ts +9 -0
  39. package/src/common/index.js +8 -0
  40. package/src/common/interface.d.ts +122 -0
  41. package/src/common/interface.js +0 -0
  42. package/src/common/l10n.d.ts +24 -0
  43. package/src/common/l10n.js +54 -0
  44. package/src/common/number-date.d.ts +26 -0
  45. package/src/common/number-date.js +38 -0
  46. package/src/common/sheet-info.d.ts +10 -0
  47. package/src/common/sheet-info.js +17 -0
  48. package/src/common/sort.d.ts +17 -0
  49. package/src/common/sort.js +44 -0
  50. package/src/formulas/array.d.ts +47 -0
  51. package/src/formulas/array.js +718 -0
  52. package/src/formulas/basic.d.ts +47 -0
  53. package/src/formulas/basic.js +181 -0
  54. package/src/formulas/complex-numbers.d.ts +207 -0
  55. package/src/formulas/complex-numbers.js +549 -0
  56. package/src/formulas/database.d.ts +152 -0
  57. package/src/formulas/database.js +579 -0
  58. package/src/formulas/date-time-extra.d.ts +97 -0
  59. package/src/formulas/date-time-extra.js +415 -0
  60. package/src/formulas/date-time-intl.d.ts +57 -0
  61. package/src/formulas/date-time-intl.js +309 -0
  62. package/src/formulas/date-time.d.ts +164 -0
  63. package/src/formulas/date-time.js +1021 -0
  64. package/src/formulas/engineering-base.d.ts +150 -0
  65. package/src/formulas/engineering-base.js +404 -0
  66. package/src/formulas/engineering-bessel.d.ts +65 -0
  67. package/src/formulas/engineering-bessel.js +167 -0
  68. package/src/formulas/engineering-convert.d.ts +35 -0
  69. package/src/formulas/engineering-convert.js +120 -0
  70. package/src/formulas/engineering-misc.d.ts +64 -0
  71. package/src/formulas/engineering-misc.js +168 -0
  72. package/src/formulas/financial-amortization-ecma.d.ts +87 -0
  73. package/src/formulas/financial-amortization-ecma.js +288 -0
  74. package/src/formulas/financial-annuity.d.ts +104 -0
  75. package/src/formulas/financial-annuity.js +419 -0
  76. package/src/formulas/financial-bond-helpers.d.ts +106 -0
  77. package/src/formulas/financial-bond-helpers.js +190 -0
  78. package/src/formulas/financial-cashflow.d.ts +47 -0
  79. package/src/formulas/financial-cashflow.js +203 -0
  80. package/src/formulas/financial-coupons.d.ts +227 -0
  81. package/src/formulas/financial-coupons.js +810 -0
  82. package/src/formulas/financial-depreciation.d.ts +64 -0
  83. package/src/formulas/financial-depreciation.js +247 -0
  84. package/src/formulas/financial-rates.d.ts +54 -0
  85. package/src/formulas/financial-rates.js +140 -0
  86. package/src/formulas/financial-securities.d.ts +126 -0
  87. package/src/formulas/financial-securities.js +488 -0
  88. package/src/formulas/formula-math-helpers.d.ts +212 -0
  89. package/src/formulas/formula-math-helpers.js +599 -0
  90. package/src/formulas/formula-module-base.d.ts +54 -0
  91. package/src/formulas/formula-module-base.js +125 -0
  92. package/src/formulas/formula-owner.d.ts +17 -0
  93. package/src/formulas/formula-owner.js +0 -0
  94. package/src/formulas/index.d.ts +68 -0
  95. package/src/formulas/index.js +67 -0
  96. package/src/formulas/information-advanced.d.ts +44 -0
  97. package/src/formulas/information-advanced.js +157 -0
  98. package/src/formulas/information-ecma.d.ts +33 -0
  99. package/src/formulas/information-ecma.js +88 -0
  100. package/src/formulas/information-extra.d.ts +146 -0
  101. package/src/formulas/information-extra.js +351 -0
  102. package/src/formulas/information.d.ts +34 -0
  103. package/src/formulas/information.js +78 -0
  104. package/src/formulas/logical-extra.d.ts +75 -0
  105. package/src/formulas/logical-extra.js +217 -0
  106. package/src/formulas/logical.d.ts +83 -0
  107. package/src/formulas/logical.js +296 -0
  108. package/src/formulas/lookup-array.d.ts +98 -0
  109. package/src/formulas/lookup-array.js +364 -0
  110. package/src/formulas/lookup-ref-extra.d.ts +64 -0
  111. package/src/formulas/lookup-ref-extra.js +180 -0
  112. package/src/formulas/lookup-ref.d.ts +84 -0
  113. package/src/formulas/lookup-ref.js +263 -0
  114. package/src/formulas/lookup.d.ts +114 -0
  115. package/src/formulas/lookup.js +881 -0
  116. package/src/formulas/math-aggregate.d.ts +74 -0
  117. package/src/formulas/math-aggregate.js +376 -0
  118. package/src/formulas/math-ceiling-ecma.d.ts +42 -0
  119. package/src/formulas/math-ceiling-ecma.js +123 -0
  120. package/src/formulas/math-combinatorics.d.ts +75 -0
  121. package/src/formulas/math-combinatorics.js +290 -0
  122. package/src/formulas/math-misc.d.ts +164 -0
  123. package/src/formulas/math-misc.js +889 -0
  124. package/src/formulas/math-number.d.ts +76 -0
  125. package/src/formulas/math-number.js +261 -0
  126. package/src/formulas/math-rounding.d.ts +115 -0
  127. package/src/formulas/math-rounding.js +728 -0
  128. package/src/formulas/math-trig-hyperbolic.d.ts +55 -0
  129. package/src/formulas/math-trig-hyperbolic.js +113 -0
  130. package/src/formulas/math-trig.d.ts +165 -0
  131. package/src/formulas/math-trig.js +334 -0
  132. package/src/formulas/matrix-base.d.ts +13 -0
  133. package/src/formulas/matrix-base.js +169 -0
  134. package/src/formulas/matrix.d.ts +64 -0
  135. package/src/formulas/matrix.js +161 -0
  136. package/src/formulas/regression-ecma.d.ts +66 -0
  137. package/src/formulas/regression-ecma.js +234 -0
  138. package/src/formulas/statistical-advanced.d.ts +125 -0
  139. package/src/formulas/statistical-advanced.js +756 -0
  140. package/src/formulas/statistical-correlation.d.ts +75 -0
  141. package/src/formulas/statistical-correlation.js +198 -0
  142. package/src/formulas/statistical-dispersion.d.ts +108 -0
  143. package/src/formulas/statistical-dispersion.js +337 -0
  144. package/src/formulas/statistical-distribution-extended.d.ts +176 -0
  145. package/src/formulas/statistical-distribution-extended.js +668 -0
  146. package/src/formulas/statistical-distribution.d.ts +104 -0
  147. package/src/formulas/statistical-distribution.js +368 -0
  148. package/src/formulas/statistical-ecma.d.ts +95 -0
  149. package/src/formulas/statistical-ecma.js +392 -0
  150. package/src/formulas/statistical-extended.d.ts +136 -0
  151. package/src/formulas/statistical-extended.js +340 -0
  152. package/src/formulas/statistical-ifs.d.ts +46 -0
  153. package/src/formulas/statistical-ifs.js +180 -0
  154. package/src/formulas/statistical-moments.d.ts +84 -0
  155. package/src/formulas/statistical-moments.js +269 -0
  156. package/src/formulas/statistical-percentile.d.ts +56 -0
  157. package/src/formulas/statistical-percentile.js +195 -0
  158. package/src/formulas/statistical-sample-base.d.ts +14 -0
  159. package/src/formulas/statistical-sample-base.js +124 -0
  160. package/src/formulas/statistical.d.ts +135 -0
  161. package/src/formulas/statistical.js +542 -0
  162. package/src/formulas/text-advanced.d.ts +64 -0
  163. package/src/formulas/text-advanced.js +222 -0
  164. package/src/formulas/text-ecma.d.ts +54 -0
  165. package/src/formulas/text-ecma.js +106 -0
  166. package/src/formulas/text-extra.d.ts +216 -0
  167. package/src/formulas/text-extra.js +657 -0
  168. package/src/formulas/text.d.ts +125 -0
  169. package/src/formulas/text.js +628 -0
  170. package/src/global.js +1 -0
  171. package/src/index.d.ts +14 -0
  172. package/src/index.js +14 -0
  173. package/tslint.json +111 -0
@@ -0,0 +1,146 @@
1
+ import { IBasicFormula } from '../common/index';
2
+ import { FormulaOwner } from './formula-owner';
3
+ import { FormulaModuleBase } from './formula-module-base';
4
+ /**
5
+ * Extended information functions: ISBLANK, ISERROR, ISFORMULA, and cell metadata probes.
6
+ *
7
+ * Registers 12 functions including ISBLANK, ISTEXT, ISNONTEXT, ISLOGICAL, ISERROR, and others.
8
+ *
9
+ * @hidden
10
+ */
11
+ export declare class InformationExtraFormulas extends FormulaModuleBase {
12
+ /** Formula definitions registered with {@link BasicFormulas}. */
13
+ formulas: IBasicFormula[];
14
+ /**
15
+ * @hidden
16
+ * @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
17
+ */
18
+ constructor(owner: FormulaOwner);
19
+ private requireOne;
20
+ /**
21
+ * Returns TRUE if the value is blank.
22
+ *
23
+ * Excel: `ISBLANK(...)`.
24
+ *
25
+ * @hidden
26
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
27
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * engine.computeFormula('=ISBLANK(1)');
32
+ * ```
33
+ */
34
+ ComputeISBLANK(...args: string[]): boolean | string;
35
+ /**
36
+ * Returns TRUE if the value is text.
37
+ *
38
+ * Excel: `ISTEXT(...)`.
39
+ *
40
+ * @hidden
41
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
42
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
43
+ */
44
+ ComputeISTEXT(...args: string[]): boolean | string;
45
+ /**
46
+ * Returns TRUE if the value is not text.
47
+ *
48
+ * Excel: `ISNONTEXT(...)`.
49
+ *
50
+ * @hidden
51
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
52
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
53
+ */
54
+ ComputeISNONTEXT(...args: string[]): boolean | string;
55
+ /**
56
+ * Returns TRUE if the value is a logical value.
57
+ *
58
+ * Excel: `ISLOGICAL(...)`.
59
+ *
60
+ * @hidden
61
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
62
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
63
+ */
64
+ ComputeISLOGICAL(...args: string[]): boolean | string;
65
+ /**
66
+ * Returns TRUE if the value is any error value.
67
+ *
68
+ * Excel: `ISERROR(...)`.
69
+ *
70
+ * @hidden
71
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
72
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
73
+ */
74
+ ComputeISERROR(...args: string[]): boolean | string;
75
+ /**
76
+ * Returns TRUE if the value is any error value except #N/A.
77
+ *
78
+ * Excel: `ISERR(...)`.
79
+ *
80
+ * @hidden
81
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
82
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
83
+ */
84
+ ComputeISERR(...args: string[]): boolean | string;
85
+ /**
86
+ * Returns TRUE if the value is the #N/A error value.
87
+ *
88
+ * Excel: `ISNA(...)`.
89
+ *
90
+ * @hidden
91
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
92
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
93
+ */
94
+ ComputeISNA(...args: string[]): boolean | string;
95
+ /**
96
+ * Returns TRUE if the number is even.
97
+ *
98
+ * Excel: `ISEVEN(...)`.
99
+ *
100
+ * @hidden
101
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
102
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
103
+ */
104
+ ComputeISEVEN(...args: string[]): boolean | string;
105
+ /**
106
+ * Returns TRUE if the number is odd.
107
+ *
108
+ * Excel: `ISODD(...)`.
109
+ *
110
+ * @hidden
111
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
112
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
113
+ */
114
+ ComputeISODD(...args: string[]): boolean | string;
115
+ private parity;
116
+ /**
117
+ * Returns a value converted to a number.
118
+ *
119
+ * Excel: `N(...)`.
120
+ *
121
+ * @hidden
122
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
123
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
124
+ */
125
+ ComputeN(...args: string[]): string | number;
126
+ /**
127
+ * Returns the error value #N/A.
128
+ *
129
+ * Excel: `NA(...)`.
130
+ *
131
+ * @hidden
132
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
133
+ * @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
134
+ */
135
+ ComputeNA(...args: string[]): string;
136
+ /**
137
+ * Returns a number indicating the data type of a value.
138
+ *
139
+ * Excel: `TYPE(...)`.
140
+ *
141
+ * @hidden
142
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
143
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
144
+ */
145
+ ComputeTYPE(...args: string[]): string | number;
146
+ }
@@ -0,0 +1,351 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { FormulasErrorsStrings, CommonErrors } from '../common/index';
15
+ import { isNullOrUndefined } from '@syncfusion/ej2-base';
16
+ import { FormulaModuleBase } from './formula-module-base';
17
+ /**
18
+ * Extended information functions: ISBLANK, ISERROR, ISFORMULA, and cell metadata probes.
19
+ *
20
+ * Registers 12 functions including ISBLANK, ISTEXT, ISNONTEXT, ISLOGICAL, ISERROR, and others.
21
+ *
22
+ * @hidden
23
+ */
24
+ var InformationExtraFormulas = /** @class */ (function (_super) {
25
+ __extends(InformationExtraFormulas, _super);
26
+ /**
27
+ * @hidden
28
+ * @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
29
+ */
30
+ function InformationExtraFormulas(owner) {
31
+ var _this = _super.call(this, owner) || this;
32
+ /** Formula definitions registered with {@link BasicFormulas}. */
33
+ _this.formulas = [
34
+ { formulaName: 'ISBLANK', category: 'Information', description: 'Returns TRUE if the value is blank.' },
35
+ { formulaName: 'ISTEXT', category: 'Information', description: 'Returns TRUE if the value is text.' },
36
+ { formulaName: 'ISNONTEXT', category: 'Information', description: 'Returns TRUE if the value is not text.' },
37
+ { formulaName: 'ISLOGICAL', category: 'Information', description: 'Returns TRUE if the value is a logical value.' },
38
+ { formulaName: 'ISERROR', category: 'Information', description: 'Returns TRUE if the value is any error value.' },
39
+ { formulaName: 'ISERR', category: 'Information', description: 'Returns TRUE if the value is any error value except #N/A.' },
40
+ { formulaName: 'ISNA', category: 'Information', description: 'Returns TRUE if the value is the #N/A error value.' },
41
+ { formulaName: 'ISEVEN', category: 'Information', description: 'Returns TRUE if the number is even.' },
42
+ { formulaName: 'ISODD', category: 'Information', description: 'Returns TRUE if the number is odd.' },
43
+ { formulaName: 'N', category: 'Information', description: 'Returns a value converted to a number.' },
44
+ { formulaName: 'NA', category: 'Information', description: 'Returns the error value #N/A.' },
45
+ { formulaName: 'TYPE', category: 'Information', description: 'Returns a number indicating the data type of a value.' }
46
+ ];
47
+ return _this;
48
+ }
49
+ InformationExtraFormulas.prototype.requireOne = function (args) {
50
+ if (isNullOrUndefined(args) || args.length !== 1) {
51
+ return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
52
+ }
53
+ return null;
54
+ };
55
+ /**
56
+ * Returns TRUE if the value is blank.
57
+ *
58
+ * Excel: `ISBLANK(...)`.
59
+ *
60
+ * @hidden
61
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
62
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * engine.computeFormula('=ISBLANK(1)');
67
+ * ```
68
+ */
69
+ InformationExtraFormulas.prototype.ComputeISBLANK = function () {
70
+ var args = [];
71
+ for (var _i = 0; _i < arguments.length; _i++) {
72
+ args[_i] = arguments[_i];
73
+ }
74
+ var bad = this.requireOne(args);
75
+ if (bad) {
76
+ return bad;
77
+ }
78
+ if (this.parent.isCellReference(args[0])) {
79
+ return this.parent.getValueFromArg(args[0]) === '';
80
+ }
81
+ var val = this.parent.getValueFromArg(args[0]);
82
+ return val === '';
83
+ };
84
+ /**
85
+ * Returns TRUE if the value is text.
86
+ *
87
+ * Excel: `ISTEXT(...)`.
88
+ *
89
+ * @hidden
90
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
91
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
92
+ */
93
+ InformationExtraFormulas.prototype.ComputeISTEXT = function () {
94
+ var args = [];
95
+ for (var _i = 0; _i < arguments.length; _i++) {
96
+ args[_i] = arguments[_i];
97
+ }
98
+ var bad = this.requireOne(args);
99
+ if (bad) {
100
+ return bad;
101
+ }
102
+ var val = this.parent.getValueFromArg(args[0]);
103
+ if (this.parent.getErrorStrings().indexOf(val) > -1) {
104
+ return false;
105
+ }
106
+ if (val === '') {
107
+ return false;
108
+ }
109
+ if (val.toUpperCase() === this.parent.trueValue || val.toUpperCase() === this.parent.falseValue) {
110
+ return false;
111
+ }
112
+ return isNaN(this.parent.parseFloat(val)) || (!this.parent.isCellReference(args[0]) && args[0].indexOf(this.parent.tic) > -1);
113
+ };
114
+ /**
115
+ * Returns TRUE if the value is not text.
116
+ *
117
+ * Excel: `ISNONTEXT(...)`.
118
+ *
119
+ * @hidden
120
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
121
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
122
+ */
123
+ InformationExtraFormulas.prototype.ComputeISNONTEXT = function () {
124
+ var args = [];
125
+ for (var _i = 0; _i < arguments.length; _i++) {
126
+ args[_i] = arguments[_i];
127
+ }
128
+ var result = this.ComputeISTEXT.apply(this, args);
129
+ return typeof result === 'string' ? result : !result;
130
+ };
131
+ /**
132
+ * Returns TRUE if the value is a logical value.
133
+ *
134
+ * Excel: `ISLOGICAL(...)`.
135
+ *
136
+ * @hidden
137
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
138
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
139
+ */
140
+ InformationExtraFormulas.prototype.ComputeISLOGICAL = function () {
141
+ var args = [];
142
+ for (var _i = 0; _i < arguments.length; _i++) {
143
+ args[_i] = arguments[_i];
144
+ }
145
+ var bad = this.requireOne(args);
146
+ if (bad) {
147
+ return bad;
148
+ }
149
+ var val = this.parent.getValueFromArg(args[0]).toUpperCase();
150
+ return val === this.parent.trueValue || val === this.parent.falseValue;
151
+ };
152
+ /**
153
+ * Returns TRUE if the value is any error value.
154
+ *
155
+ * Excel: `ISERROR(...)`.
156
+ *
157
+ * @hidden
158
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
159
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
160
+ */
161
+ InformationExtraFormulas.prototype.ComputeISERROR = function () {
162
+ var args = [];
163
+ for (var _i = 0; _i < arguments.length; _i++) {
164
+ args[_i] = arguments[_i];
165
+ }
166
+ var bad = this.requireOne(args);
167
+ if (bad) {
168
+ return bad;
169
+ }
170
+ var val = this.parent.getValueFromArg(args[0]);
171
+ return this.parent.getErrorStrings().indexOf(val) > -1 || /^#[A-Z/?!]+$/.test(val);
172
+ };
173
+ /**
174
+ * Returns TRUE if the value is any error value except #N/A.
175
+ *
176
+ * Excel: `ISERR(...)`.
177
+ *
178
+ * @hidden
179
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
180
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
181
+ */
182
+ InformationExtraFormulas.prototype.ComputeISERR = function () {
183
+ var args = [];
184
+ for (var _i = 0; _i < arguments.length; _i++) {
185
+ args[_i] = arguments[_i];
186
+ }
187
+ var bad = this.requireOne(args);
188
+ if (bad) {
189
+ return bad;
190
+ }
191
+ var val = this.parent.getValueFromArg(args[0]);
192
+ if (val === this.parent.getErrorStrings()[CommonErrors.NA] || val === '#N/A') {
193
+ return false;
194
+ }
195
+ return this.parent.getErrorStrings().indexOf(val) > -1 || /^#[A-Z/?!]+$/.test(val);
196
+ };
197
+ /**
198
+ * Returns TRUE if the value is the #N/A error value.
199
+ *
200
+ * Excel: `ISNA(...)`.
201
+ *
202
+ * @hidden
203
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
204
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
205
+ */
206
+ InformationExtraFormulas.prototype.ComputeISNA = function () {
207
+ var args = [];
208
+ for (var _i = 0; _i < arguments.length; _i++) {
209
+ args[_i] = arguments[_i];
210
+ }
211
+ var bad = this.requireOne(args);
212
+ if (bad) {
213
+ return bad;
214
+ }
215
+ var val = this.parent.getValueFromArg(args[0]);
216
+ return val === this.parent.getErrorStrings()[CommonErrors.NA] || val === '#N/A';
217
+ };
218
+ /**
219
+ * Returns TRUE if the number is even.
220
+ *
221
+ * Excel: `ISEVEN(...)`.
222
+ *
223
+ * @hidden
224
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
225
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
226
+ */
227
+ InformationExtraFormulas.prototype.ComputeISEVEN = function () {
228
+ var args = [];
229
+ for (var _i = 0; _i < arguments.length; _i++) {
230
+ args[_i] = arguments[_i];
231
+ }
232
+ return this.parity(args, true);
233
+ };
234
+ /**
235
+ * Returns TRUE if the number is odd.
236
+ *
237
+ * Excel: `ISODD(...)`.
238
+ *
239
+ * @hidden
240
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
241
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
242
+ */
243
+ InformationExtraFormulas.prototype.ComputeISODD = function () {
244
+ var args = [];
245
+ for (var _i = 0; _i < arguments.length; _i++) {
246
+ args[_i] = arguments[_i];
247
+ }
248
+ return this.parity(args, false);
249
+ };
250
+ InformationExtraFormulas.prototype.parity = function (args, wantEven) {
251
+ var errCollection = this.parent.getErrorStrings();
252
+ var bad = this.requireOne(args);
253
+ if (bad) {
254
+ return bad;
255
+ }
256
+ var num = this.resolveNumberArg(args[0]);
257
+ if (typeof num === 'string') {
258
+ return errCollection[CommonErrors.Value];
259
+ }
260
+ var truncated = num < 0 ? Math.ceil(num) : Math.floor(num);
261
+ var even = truncated % 2 === 0;
262
+ return wantEven ? even : !even;
263
+ };
264
+ /**
265
+ * Returns a value converted to a number.
266
+ *
267
+ * Excel: `N(...)`.
268
+ *
269
+ * @hidden
270
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
271
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
272
+ */
273
+ InformationExtraFormulas.prototype.ComputeN = function () {
274
+ var args = [];
275
+ for (var _i = 0; _i < arguments.length; _i++) {
276
+ args[_i] = arguments[_i];
277
+ }
278
+ var errCollection = this.parent.getErrorStrings();
279
+ var bad = this.requireOne(args);
280
+ if (bad) {
281
+ return bad;
282
+ }
283
+ var val = this.parent.getValueFromArg(args[0]);
284
+ if (errCollection.indexOf(val) > -1) {
285
+ return val;
286
+ }
287
+ if (val.toUpperCase() === this.parent.trueValue) {
288
+ return '1';
289
+ }
290
+ if (val.toUpperCase() === this.parent.falseValue || val === '') {
291
+ return '0';
292
+ }
293
+ var num = this.parent.parseFloat(val);
294
+ return isNaN(num) ? '0' : num.toString();
295
+ };
296
+ /**
297
+ * Returns the error value #N/A.
298
+ *
299
+ * Excel: `NA(...)`.
300
+ *
301
+ * @hidden
302
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
303
+ * @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
304
+ */
305
+ InformationExtraFormulas.prototype.ComputeNA = function () {
306
+ var args = [];
307
+ for (var _i = 0; _i < arguments.length; _i++) {
308
+ args[_i] = arguments[_i];
309
+ }
310
+ if (args && args.length === 1 && args[0] === '') {
311
+ return this.parent.getErrorStrings()[CommonErrors.NA];
312
+ }
313
+ if (args && args.length > 0 && !(args.length === 1 && args[0] === '')) {
314
+ return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
315
+ }
316
+ return this.parent.getErrorStrings()[CommonErrors.NA];
317
+ };
318
+ /**
319
+ * Returns a number indicating the data type of a value.
320
+ *
321
+ * Excel: `TYPE(...)`.
322
+ *
323
+ * @hidden
324
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
325
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
326
+ */
327
+ InformationExtraFormulas.prototype.ComputeTYPE = function () {
328
+ var args = [];
329
+ for (var _i = 0; _i < arguments.length; _i++) {
330
+ args[_i] = arguments[_i];
331
+ }
332
+ var bad = this.requireOne(args);
333
+ if (bad) {
334
+ return bad;
335
+ }
336
+ var val = this.parent.getValueFromArg(args[0]);
337
+ if (this.parent.getErrorStrings().indexOf(val) > -1 || /^#[A-Z/?!]+$/.test(val)) {
338
+ return '16';
339
+ }
340
+ if (val.toUpperCase() === this.parent.trueValue || val.toUpperCase() === this.parent.falseValue) {
341
+ return '4';
342
+ }
343
+ if (val !== '' && !isNaN(this.parent.parseFloat(val)) &&
344
+ (this.parent.isCellReference(args[0]) || args[0].indexOf(this.parent.tic) === -1)) {
345
+ return '1';
346
+ }
347
+ return '2';
348
+ };
349
+ return InformationExtraFormulas;
350
+ }(FormulaModuleBase));
351
+ export { InformationExtraFormulas };
@@ -0,0 +1,34 @@
1
+ import { IBasicFormula } from '../common/index';
2
+ import { FormulaOwner } from './formula-owner';
3
+ import { FormulaModuleBase } from './formula-module-base';
4
+ /**
5
+ * Type and content inspection functions that classify cell values (numbers, text, errors).
6
+ *
7
+ * Registered functions: ISNUMBER.
8
+ *
9
+ * @hidden
10
+ */
11
+ export declare class InformationFormulas extends FormulaModuleBase {
12
+ /** Formula definitions registered with {@link BasicFormulas}. */
13
+ formulas: IBasicFormula[];
14
+ /**
15
+ * @hidden
16
+ * @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
17
+ */
18
+ constructor(owner: FormulaOwner);
19
+ /**
20
+ * Returns TRUE, if the argument is number and FALSE otherwise.
21
+ *
22
+ * Excel: `ISNUMBER(...)`.
23
+ *
24
+ * @hidden
25
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
26
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * engine.computeFormula('=ISNUMBER(1)');
31
+ * ```
32
+ */
33
+ ComputeISNUMBER(...args: string[]): boolean | string;
34
+ }
@@ -0,0 +1,78 @@
1
+ var __extends = (this && this.__extends) || (function () {
2
+ var extendStatics = function (d, b) {
3
+ extendStatics = Object.setPrototypeOf ||
4
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
5
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
6
+ return extendStatics(d, b);
7
+ };
8
+ return function (d, b) {
9
+ extendStatics(d, b);
10
+ function __() { this.constructor = d; }
11
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
12
+ };
13
+ })();
14
+ import { FormulasErrorsStrings } from '../common/index';
15
+ import { FormulaModuleBase } from './formula-module-base';
16
+ /**
17
+ * Type and content inspection functions that classify cell values (numbers, text, errors).
18
+ *
19
+ * Registered functions: ISNUMBER.
20
+ *
21
+ * @hidden
22
+ */
23
+ var InformationFormulas = /** @class */ (function (_super) {
24
+ __extends(InformationFormulas, _super);
25
+ /**
26
+ * @hidden
27
+ * @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
28
+ */
29
+ function InformationFormulas(owner) {
30
+ var _this = _super.call(this, owner) || this;
31
+ /** Formula definitions registered with {@link BasicFormulas}. */
32
+ _this.formulas = [
33
+ { formulaName: 'ISNUMBER', category: 'Information', description: 'Returns TRUE, if the argument is number and FALSE otherwise.' }
34
+ ];
35
+ return _this;
36
+ }
37
+ /**
38
+ * Returns TRUE, if the argument is number and FALSE otherwise.
39
+ *
40
+ * Excel: `ISNUMBER(...)`.
41
+ *
42
+ * @hidden
43
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
44
+ * @returns {boolean} - Boolean result, nested-formula numeric string (`"0"`/`"1"`), or an Excel error token.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * engine.computeFormula('=ISNUMBER(1)');
49
+ * ```
50
+ */
51
+ InformationFormulas.prototype.ComputeISNUMBER = function () {
52
+ var args = [];
53
+ for (var _i = 0; _i < arguments.length; _i++) {
54
+ args[_i] = arguments[_i];
55
+ }
56
+ var argArr = args;
57
+ var isNestedFormula;
58
+ if (argArr && argArr[argArr.length - 1] === 'nestedFormulaTrue') {
59
+ isNestedFormula = true;
60
+ argArr.pop();
61
+ }
62
+ if (args.length === 1 && args[0] === '') {
63
+ return this.parent.formulaErrorStrings[FormulasErrorsStrings.InvalidArguments];
64
+ }
65
+ else if (args.length !== 1) {
66
+ return this.parent.formulaErrorStrings[FormulasErrorsStrings.WrongNumberArguments];
67
+ }
68
+ var orgValue = (this.parent.isCellReference(argArr[0])) ? this.parent.getValueFromArg(argArr[0]) :
69
+ this.parent.getValueFromArg(argArr[0].split(this.parent.tic).join(''));
70
+ if (orgValue.toString() === '' || args.toString().startsWith(this.parent.tic)) {
71
+ return isNestedFormula ? '0' : false;
72
+ }
73
+ var isLogVal = !isNaN(this.parent.parseFloat(orgValue));
74
+ return isNestedFormula ? (isLogVal ? '1' : '0') : isLogVal;
75
+ };
76
+ return InformationFormulas;
77
+ }(FormulaModuleBase));
78
+ export { InformationFormulas };
@@ -0,0 +1,75 @@
1
+ import { IBasicFormula } from '../common/index';
2
+ import { FormulaOwner } from './formula-owner';
3
+ import { FormulaModuleBase } from './formula-module-base';
4
+ /**
5
+ * Extended logical helpers including IFS, SWITCH, XOR, and multi-condition boolean tests.
6
+ *
7
+ * Registered functions: TRUE, FALSE, XOR, IFNA, SWITCH.
8
+ *
9
+ * @hidden
10
+ */
11
+ export declare class LogicalExtraFormulas extends FormulaModuleBase {
12
+ /** Formula definitions registered with {@link BasicFormulas}. */
13
+ formulas: IBasicFormula[];
14
+ /**
15
+ * @hidden
16
+ * @param {FormulaOwner} owner - Formula registration owner ({@link BasicFormulas}).
17
+ */
18
+ constructor(owner: FormulaOwner);
19
+ /**
20
+ * Returns the logical value TRUE.
21
+ *
22
+ * Excel: `TRUE(...)`.
23
+ *
24
+ * @hidden
25
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
26
+ * @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * engine.computeFormula('=TRUE(1)');
31
+ * ```
32
+ */
33
+ ComputeTRUE(...args: string[]): string;
34
+ /**
35
+ * Returns the logical value FALSE.
36
+ *
37
+ * Excel: `FALSE(...)`.
38
+ *
39
+ * @hidden
40
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
41
+ * @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
42
+ */
43
+ ComputeFALSE(...args: string[]): string;
44
+ private isTruthy;
45
+ /**
46
+ * Returns a logical exclusive OR of all arguments.
47
+ *
48
+ * Excel: `XOR(...)`.
49
+ *
50
+ * @hidden
51
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
52
+ * @returns {string | number} - Computed text result or an Excel error token such as `#VALUE!`.
53
+ */
54
+ ComputeXOR(...args: string[]): string;
55
+ /**
56
+ * Returns the value you specify if the expression resolves to #N/A; otherwise returns the result of the expression.
57
+ *
58
+ * Excel: `IFNA(...)`.
59
+ *
60
+ * @hidden
61
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
62
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
63
+ */
64
+ ComputeIFNA(...args: string[]): string | number;
65
+ /**
66
+ * Evaluates an expression against a list of values and returns the result corresponding to the first matching value.
67
+ *
68
+ * Excel: `SWITCH(...)`.
69
+ *
70
+ * @hidden
71
+ * @param {string[]} args - Formula argument tokens from the Calculate engine.
72
+ * @returns {string | number} - Computed Excel-compatible numeric or text result, or an error token such as `#VALUE!`, `#NUM!`, `#N/A`.
73
+ */
74
+ ComputeSWITCH(...args: string[]): string | number;
75
+ }