@leankylin-sheet/formula-parser 4.0.56 → 4.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +246 -246
- package/dist/index.esm.js +137 -137
- package/dist/index.js +137 -137
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,246 +1,246 @@
|
|
|
1
|
-
:warning: This repository is deprecated. We've released new and improved [HyperFormula](https://github.com/handsontable/hyperformula/) engine.
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<details>
|
|
5
|
-
|
|
6
|
-
Formula Parser [](https://travis-ci.org/handsontable/formula-parser) [](https://codeclimate.com/github/handsontable/formula-parser/coverage) [](https://www.npmjs.com/package/hot-formula-parser)
|
|
7
|
-
==========
|
|
8
|
-
Library provides a `Parser` class that evaluates excel and mathematical formulas.
|
|
9
|
-
|
|
10
|
-
- - -
|
|
11
|
-
|
|
12
|
-
## Install
|
|
13
|
-
|
|
14
|
-
A recommended way to install Formula Parser is through [NPM](https://www.npmjs.com/) using the following command:
|
|
15
|
-
|
|
16
|
-
```sh
|
|
17
|
-
$ npm install hot-formula-parser --save
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Node.js:
|
|
21
|
-
```js
|
|
22
|
-
var FormulaParser = require('hot-formula-parser').Parser;
|
|
23
|
-
var parser = new FormulaParser();
|
|
24
|
-
|
|
25
|
-
parser.parse('SUM(1, 6, 7)'); // It returns `Object {error: null, result: 14}`
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Browser:
|
|
29
|
-
```html
|
|
30
|
-
<script src="/node_modules/hot-formula-parser/dist/formula-parser.min.js"></script>
|
|
31
|
-
<script>
|
|
32
|
-
var parser = new formulaParser.Parser();
|
|
33
|
-
|
|
34
|
-
parser.parse('SUM(1, 6, 7)'); // It returns `Object {error: null, result: 14}`
|
|
35
|
-
</script>
|
|
36
|
-
```
|
|
37
|
-
## Features
|
|
38
|
-
|
|
39
|
-
It supports:
|
|
40
|
-
|
|
41
|
-
* Any numbers, negative and positive as float or integer;
|
|
42
|
-
* Arithmetic operations like `+`, `-`, `/`, `*`, `%`, `^`;
|
|
43
|
-
* Logical operations like `AND()`, `OR()`, `NOT()`, `XOR()`;
|
|
44
|
-
* Comparison operations like `=`, `>`, `>=`, `<`, `<=`, `<>`;
|
|
45
|
-
* All JavaScript Math constants like `PI()`, `E()`, `LN10()`, `LN2()`, `LOG10E()`, `LOG2E()`, `SQRT1_2()`, `SQRT2()`;
|
|
46
|
-
* String operations like `&` (concatenation eq. `parser.parse('-(2&5)');` will return `-25`);
|
|
47
|
-
* All excel formulas defined in [formula.js](https://github.com/handsontable/formula.js);
|
|
48
|
-
* Relative and absolute cell coordinates like `A1`, `$A1`, `A$1`, `$A$1`;
|
|
49
|
-
* Build-in variables like `TRUE`, `FALSE`, `NULL`
|
|
50
|
-
* Custom variables;
|
|
51
|
-
* Custom functions/formulas;
|
|
52
|
-
* Node and Browser environment.
|
|
53
|
-
|
|
54
|
-
## API (methods)
|
|
55
|
-
|
|
56
|
-
```js
|
|
57
|
-
var parser = new formulaParser.Parser();
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### .parse(expression)
|
|
61
|
-
|
|
62
|
-
Parses and evaluates provided expression. It always returns an object with `result` and `error` properties. `result` property
|
|
63
|
-
always keep evaluated value. If error occurs `error` property will be set as:
|
|
64
|
-
* `#ERROR!` General error;
|
|
65
|
-
* `#DIV/0!` Divide by zero error;
|
|
66
|
-
* `#NAME?` Not recognised function name or variable name;
|
|
67
|
-
* `#N/A` Indicates that a value is not available to a formula;
|
|
68
|
-
* `#NUM!` Occurs when formula encounters an invalid number;
|
|
69
|
-
* `#VALUE!` Occurs when one of formula arguments is of the wrong type.
|
|
70
|
-
|
|
71
|
-
```js
|
|
72
|
-
parser.parse('(1 + 5 + (5 * 10)) / 10'); // returns `Object {error: null, result: 5.6}`
|
|
73
|
-
parser.parse('SUM(MY_VAR)'); // returns `Object {error: "#NAME?", result: null}`
|
|
74
|
-
parser.parse('1;;1'); // returns `Object {error: "#ERROR!", result: null}`
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
### .setVariable(name, value)
|
|
78
|
-
|
|
79
|
-
Set predefined variable name which can be visible while parsing formula expression.
|
|
80
|
-
|
|
81
|
-
```js
|
|
82
|
-
parser.setVariable('MY_VARIABLE', 5);
|
|
83
|
-
parser.setVariable('fooBar', 10);
|
|
84
|
-
|
|
85
|
-
parser.parse('(1 + MY_VARIABLE + (5 * fooBar)) / fooBar'); // returns `5.6`
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
### .getVariable(name)
|
|
89
|
-
|
|
90
|
-
Get variable name.
|
|
91
|
-
|
|
92
|
-
```js
|
|
93
|
-
parser.setVariable('fooBar', 10);
|
|
94
|
-
|
|
95
|
-
parser.getVariable('fooBar'); // returns `10`
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
### .setFunction(name, fn)
|
|
99
|
-
|
|
100
|
-
Set custom function which can be visible while parsing formula expression.
|
|
101
|
-
|
|
102
|
-
```js
|
|
103
|
-
parser.setFunction('ADD_5', function(params) {
|
|
104
|
-
return params[0] + 5;
|
|
105
|
-
});
|
|
106
|
-
parser.setFunction('GET_LETTER', function(params) {
|
|
107
|
-
var string = params[0];
|
|
108
|
-
var index = params[1] - 1;
|
|
109
|
-
|
|
110
|
-
return string.charAt(index);
|
|
111
|
-
});
|
|
112
|
-
|
|
113
|
-
parser.parse('SUM(4, ADD_5(1))'); // returns `10`
|
|
114
|
-
parser.parse('GET_LETTER("Some string", 3)'); // returns `m`
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### .getFunction(name)
|
|
118
|
-
|
|
119
|
-
Get custom function.
|
|
120
|
-
|
|
121
|
-
```js
|
|
122
|
-
parser.setFunction('ADD_5', function(params) {
|
|
123
|
-
return params[0] + 5;
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
parser.getFunction('ADD_5')([1]); // returns `6`
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
### .SUPPORTED_FORMULAS
|
|
130
|
-
|
|
131
|
-
List of all supported formulas function.
|
|
132
|
-
|
|
133
|
-
```js
|
|
134
|
-
require('hot-formula-parser').SUPPORTED_FORMULAS; // An array of formula names
|
|
135
|
-
```
|
|
136
|
-
|
|
137
|
-
## API (hooks)
|
|
138
|
-
|
|
139
|
-
### 'callVariable' (name, done)
|
|
140
|
-
|
|
141
|
-
Fired while retrieving variable. If variable was defined earlier using `setVariable` you can overwrite it by this hook.
|
|
142
|
-
|
|
143
|
-
```js
|
|
144
|
-
parser.on('callVariable', function(name, done) {
|
|
145
|
-
if (name === 'foo') {
|
|
146
|
-
done(Math.PI / 2);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
parser.parse('SUM(SIN(foo), COS(foo))'); // returns `1`
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
### 'callFunction' (name, params, done)
|
|
154
|
-
|
|
155
|
-
Fired while calling function. If function was defined earlier using `setFunction` you can overwrite it's result by this hook.
|
|
156
|
-
You can also use this to override result of build-in formulas.
|
|
157
|
-
|
|
158
|
-
```js
|
|
159
|
-
parser.on('callFunction', function(name, params, done) {
|
|
160
|
-
if (name === 'ADD_5') {
|
|
161
|
-
done(params[0] + 5);
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
|
|
165
|
-
parser.parse('ADD_5(3)'); // returns `8`
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
### 'callCellValue' (cellCoord, done)
|
|
169
|
-
|
|
170
|
-
Fired while retrieving cell value by its label (eq: `B3`, `B$3`, `B$3`, `$B$3`).
|
|
171
|
-
|
|
172
|
-
```js
|
|
173
|
-
parser.on('callCellValue', function(cellCoord, done) {
|
|
174
|
-
// using label
|
|
175
|
-
if (cellCoord.label === 'B$6') {
|
|
176
|
-
done('hello');
|
|
177
|
-
}
|
|
178
|
-
// or using indexes
|
|
179
|
-
if (cellCoord.row.index === 5 && cellCoord.row.isAbsolute && cellCoord.column.index === 1 && !cellCoord.column.isAbsolute) {
|
|
180
|
-
done('hello');
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
if (cellCoord.label === 'C6') {
|
|
184
|
-
done(0.75);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
parser.parse('B$6'); // returns `"hello"`
|
|
189
|
-
parser.parse('B$6&" world"'); // returns `"hello world"`
|
|
190
|
-
parser.parse('FISHER(C6)'); // returns `0.9729550745276566`
|
|
191
|
-
```
|
|
192
|
-
|
|
193
|
-
### 'callRangeValue' (startCellCoord, endCellCoord, done)
|
|
194
|
-
|
|
195
|
-
Fired while retrieving cells range value (eq: `A1:B3`, `$A1:B$3`, `A$1:B$3`, `$A$1:$B$3`).
|
|
196
|
-
|
|
197
|
-
```js
|
|
198
|
-
parser.on('callRangeValue', function(startCellCoord, endCellCoord, done) {
|
|
199
|
-
var data = [
|
|
200
|
-
[1, 2, 3, 4, 5],
|
|
201
|
-
[6, 7, 8, 9, 10],
|
|
202
|
-
[11, 12, 13, 14, 15],
|
|
203
|
-
[16, 17, 18, 19, 20],
|
|
204
|
-
];
|
|
205
|
-
var fragment = [];
|
|
206
|
-
|
|
207
|
-
for (var row = startCellCoord.row.index; row <= endCellCoord.row.index; row++) {
|
|
208
|
-
var rowData = data[row];
|
|
209
|
-
var colFragment = [];
|
|
210
|
-
|
|
211
|
-
for (var col = startCellCoord.column.index; col <= endCellCoord.column.index; col++) {
|
|
212
|
-
colFragment.push(rowData[col]);
|
|
213
|
-
}
|
|
214
|
-
fragment.push(colFragment);
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
if (fragment) {
|
|
218
|
-
done(fragment);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
|
|
222
|
-
parser.parse('JOIN(A1:E2)'); // returns `"1,2,3,4,5,6,7,8,9,10"`
|
|
223
|
-
parser.parse('COLUMNS(A1:E2)'); // returns `5`
|
|
224
|
-
parser.parse('ROWS(A1:E2)'); // returns `2`
|
|
225
|
-
parser.parse('COUNT(A1:E2)'); // returns `10`
|
|
226
|
-
parser.parse('COUNTIF(A1:E2, ">5")'); // returns `5`
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
### Want to help?
|
|
230
|
-
|
|
231
|
-
Please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
232
|
-
|
|
233
|
-
### Changelog
|
|
234
|
-
|
|
235
|
-
To see the list of recent changes, see [Releases section](https://github.com/handsontable/formula-parser/releases).
|
|
236
|
-
|
|
237
|
-
### License
|
|
238
|
-
|
|
239
|
-
The MIT License (see the [LICENSE](https://github.com/handsontable/formula-parser/blob/master/LICENSE) file for the full text).
|
|
240
|
-
|
|
241
|
-
### Contact
|
|
242
|
-
|
|
243
|
-
You can contact us at hello@handsontable.com.
|
|
244
|
-
|
|
245
|
-
</details>
|
|
246
|
-
|
|
1
|
+
:warning: This repository is deprecated. We've released new and improved [HyperFormula](https://github.com/handsontable/hyperformula/) engine.
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
<details>
|
|
5
|
+
|
|
6
|
+
Formula Parser [](https://travis-ci.org/handsontable/formula-parser) [](https://codeclimate.com/github/handsontable/formula-parser/coverage) [](https://www.npmjs.com/package/hot-formula-parser)
|
|
7
|
+
==========
|
|
8
|
+
Library provides a `Parser` class that evaluates excel and mathematical formulas.
|
|
9
|
+
|
|
10
|
+
- - -
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
A recommended way to install Formula Parser is through [NPM](https://www.npmjs.com/) using the following command:
|
|
15
|
+
|
|
16
|
+
```sh
|
|
17
|
+
$ npm install hot-formula-parser --save
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Node.js:
|
|
21
|
+
```js
|
|
22
|
+
var FormulaParser = require('hot-formula-parser').Parser;
|
|
23
|
+
var parser = new FormulaParser();
|
|
24
|
+
|
|
25
|
+
parser.parse('SUM(1, 6, 7)'); // It returns `Object {error: null, result: 14}`
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Browser:
|
|
29
|
+
```html
|
|
30
|
+
<script src="/node_modules/hot-formula-parser/dist/formula-parser.min.js"></script>
|
|
31
|
+
<script>
|
|
32
|
+
var parser = new formulaParser.Parser();
|
|
33
|
+
|
|
34
|
+
parser.parse('SUM(1, 6, 7)'); // It returns `Object {error: null, result: 14}`
|
|
35
|
+
</script>
|
|
36
|
+
```
|
|
37
|
+
## Features
|
|
38
|
+
|
|
39
|
+
It supports:
|
|
40
|
+
|
|
41
|
+
* Any numbers, negative and positive as float or integer;
|
|
42
|
+
* Arithmetic operations like `+`, `-`, `/`, `*`, `%`, `^`;
|
|
43
|
+
* Logical operations like `AND()`, `OR()`, `NOT()`, `XOR()`;
|
|
44
|
+
* Comparison operations like `=`, `>`, `>=`, `<`, `<=`, `<>`;
|
|
45
|
+
* All JavaScript Math constants like `PI()`, `E()`, `LN10()`, `LN2()`, `LOG10E()`, `LOG2E()`, `SQRT1_2()`, `SQRT2()`;
|
|
46
|
+
* String operations like `&` (concatenation eq. `parser.parse('-(2&5)');` will return `-25`);
|
|
47
|
+
* All excel formulas defined in [formula.js](https://github.com/handsontable/formula.js);
|
|
48
|
+
* Relative and absolute cell coordinates like `A1`, `$A1`, `A$1`, `$A$1`;
|
|
49
|
+
* Build-in variables like `TRUE`, `FALSE`, `NULL`
|
|
50
|
+
* Custom variables;
|
|
51
|
+
* Custom functions/formulas;
|
|
52
|
+
* Node and Browser environment.
|
|
53
|
+
|
|
54
|
+
## API (methods)
|
|
55
|
+
|
|
56
|
+
```js
|
|
57
|
+
var parser = new formulaParser.Parser();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### .parse(expression)
|
|
61
|
+
|
|
62
|
+
Parses and evaluates provided expression. It always returns an object with `result` and `error` properties. `result` property
|
|
63
|
+
always keep evaluated value. If error occurs `error` property will be set as:
|
|
64
|
+
* `#ERROR!` General error;
|
|
65
|
+
* `#DIV/0!` Divide by zero error;
|
|
66
|
+
* `#NAME?` Not recognised function name or variable name;
|
|
67
|
+
* `#N/A` Indicates that a value is not available to a formula;
|
|
68
|
+
* `#NUM!` Occurs when formula encounters an invalid number;
|
|
69
|
+
* `#VALUE!` Occurs when one of formula arguments is of the wrong type.
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
parser.parse('(1 + 5 + (5 * 10)) / 10'); // returns `Object {error: null, result: 5.6}`
|
|
73
|
+
parser.parse('SUM(MY_VAR)'); // returns `Object {error: "#NAME?", result: null}`
|
|
74
|
+
parser.parse('1;;1'); // returns `Object {error: "#ERROR!", result: null}`
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### .setVariable(name, value)
|
|
78
|
+
|
|
79
|
+
Set predefined variable name which can be visible while parsing formula expression.
|
|
80
|
+
|
|
81
|
+
```js
|
|
82
|
+
parser.setVariable('MY_VARIABLE', 5);
|
|
83
|
+
parser.setVariable('fooBar', 10);
|
|
84
|
+
|
|
85
|
+
parser.parse('(1 + MY_VARIABLE + (5 * fooBar)) / fooBar'); // returns `5.6`
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
### .getVariable(name)
|
|
89
|
+
|
|
90
|
+
Get variable name.
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
parser.setVariable('fooBar', 10);
|
|
94
|
+
|
|
95
|
+
parser.getVariable('fooBar'); // returns `10`
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### .setFunction(name, fn)
|
|
99
|
+
|
|
100
|
+
Set custom function which can be visible while parsing formula expression.
|
|
101
|
+
|
|
102
|
+
```js
|
|
103
|
+
parser.setFunction('ADD_5', function(params) {
|
|
104
|
+
return params[0] + 5;
|
|
105
|
+
});
|
|
106
|
+
parser.setFunction('GET_LETTER', function(params) {
|
|
107
|
+
var string = params[0];
|
|
108
|
+
var index = params[1] - 1;
|
|
109
|
+
|
|
110
|
+
return string.charAt(index);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
parser.parse('SUM(4, ADD_5(1))'); // returns `10`
|
|
114
|
+
parser.parse('GET_LETTER("Some string", 3)'); // returns `m`
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### .getFunction(name)
|
|
118
|
+
|
|
119
|
+
Get custom function.
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
parser.setFunction('ADD_5', function(params) {
|
|
123
|
+
return params[0] + 5;
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
parser.getFunction('ADD_5')([1]); // returns `6`
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### .SUPPORTED_FORMULAS
|
|
130
|
+
|
|
131
|
+
List of all supported formulas function.
|
|
132
|
+
|
|
133
|
+
```js
|
|
134
|
+
require('hot-formula-parser').SUPPORTED_FORMULAS; // An array of formula names
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## API (hooks)
|
|
138
|
+
|
|
139
|
+
### 'callVariable' (name, done)
|
|
140
|
+
|
|
141
|
+
Fired while retrieving variable. If variable was defined earlier using `setVariable` you can overwrite it by this hook.
|
|
142
|
+
|
|
143
|
+
```js
|
|
144
|
+
parser.on('callVariable', function(name, done) {
|
|
145
|
+
if (name === 'foo') {
|
|
146
|
+
done(Math.PI / 2);
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
parser.parse('SUM(SIN(foo), COS(foo))'); // returns `1`
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### 'callFunction' (name, params, done)
|
|
154
|
+
|
|
155
|
+
Fired while calling function. If function was defined earlier using `setFunction` you can overwrite it's result by this hook.
|
|
156
|
+
You can also use this to override result of build-in formulas.
|
|
157
|
+
|
|
158
|
+
```js
|
|
159
|
+
parser.on('callFunction', function(name, params, done) {
|
|
160
|
+
if (name === 'ADD_5') {
|
|
161
|
+
done(params[0] + 5);
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
parser.parse('ADD_5(3)'); // returns `8`
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 'callCellValue' (cellCoord, done)
|
|
169
|
+
|
|
170
|
+
Fired while retrieving cell value by its label (eq: `B3`, `B$3`, `B$3`, `$B$3`).
|
|
171
|
+
|
|
172
|
+
```js
|
|
173
|
+
parser.on('callCellValue', function(cellCoord, done) {
|
|
174
|
+
// using label
|
|
175
|
+
if (cellCoord.label === 'B$6') {
|
|
176
|
+
done('hello');
|
|
177
|
+
}
|
|
178
|
+
// or using indexes
|
|
179
|
+
if (cellCoord.row.index === 5 && cellCoord.row.isAbsolute && cellCoord.column.index === 1 && !cellCoord.column.isAbsolute) {
|
|
180
|
+
done('hello');
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
if (cellCoord.label === 'C6') {
|
|
184
|
+
done(0.75);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
|
|
188
|
+
parser.parse('B$6'); // returns `"hello"`
|
|
189
|
+
parser.parse('B$6&" world"'); // returns `"hello world"`
|
|
190
|
+
parser.parse('FISHER(C6)'); // returns `0.9729550745276566`
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
### 'callRangeValue' (startCellCoord, endCellCoord, done)
|
|
194
|
+
|
|
195
|
+
Fired while retrieving cells range value (eq: `A1:B3`, `$A1:B$3`, `A$1:B$3`, `$A$1:$B$3`).
|
|
196
|
+
|
|
197
|
+
```js
|
|
198
|
+
parser.on('callRangeValue', function(startCellCoord, endCellCoord, done) {
|
|
199
|
+
var data = [
|
|
200
|
+
[1, 2, 3, 4, 5],
|
|
201
|
+
[6, 7, 8, 9, 10],
|
|
202
|
+
[11, 12, 13, 14, 15],
|
|
203
|
+
[16, 17, 18, 19, 20],
|
|
204
|
+
];
|
|
205
|
+
var fragment = [];
|
|
206
|
+
|
|
207
|
+
for (var row = startCellCoord.row.index; row <= endCellCoord.row.index; row++) {
|
|
208
|
+
var rowData = data[row];
|
|
209
|
+
var colFragment = [];
|
|
210
|
+
|
|
211
|
+
for (var col = startCellCoord.column.index; col <= endCellCoord.column.index; col++) {
|
|
212
|
+
colFragment.push(rowData[col]);
|
|
213
|
+
}
|
|
214
|
+
fragment.push(colFragment);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
if (fragment) {
|
|
218
|
+
done(fragment);
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
parser.parse('JOIN(A1:E2)'); // returns `"1,2,3,4,5,6,7,8,9,10"`
|
|
223
|
+
parser.parse('COLUMNS(A1:E2)'); // returns `5`
|
|
224
|
+
parser.parse('ROWS(A1:E2)'); // returns `2`
|
|
225
|
+
parser.parse('COUNT(A1:E2)'); // returns `10`
|
|
226
|
+
parser.parse('COUNTIF(A1:E2, ">5")'); // returns `5`
|
|
227
|
+
```
|
|
228
|
+
|
|
229
|
+
### Want to help?
|
|
230
|
+
|
|
231
|
+
Please see [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
232
|
+
|
|
233
|
+
### Changelog
|
|
234
|
+
|
|
235
|
+
To see the list of recent changes, see [Releases section](https://github.com/handsontable/formula-parser/releases).
|
|
236
|
+
|
|
237
|
+
### License
|
|
238
|
+
|
|
239
|
+
The MIT License (see the [LICENSE](https://github.com/handsontable/formula-parser/blob/master/LICENSE) file for the full text).
|
|
240
|
+
|
|
241
|
+
### Contact
|
|
242
|
+
|
|
243
|
+
You can contact us at hello@handsontable.com.
|
|
244
|
+
|
|
245
|
+
</details>
|
|
246
|
+
|