spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
Removing formulas that we don't need.
author
Ben Vogt <[email protected]>
date
2017-02-15 02:19:56
stats
4 file(s) changed, 7 insertions(+), 152 deletions(-)
files
src/Formulas.ts
src/RawFormulas/RawFormulas.ts
tests/FormulasTest.ts
tests/SheetFormulaTest.ts
  1diff --git a/src/Formulas.ts b/src/Formulas.ts
  2index cec9d8c..095733b 100644
  3--- a/src/Formulas.ts
  4+++ b/src/Formulas.ts
  5@@ -3,8 +3,8 @@ import * as RawFormulas from "./RawFormulas/RawFormulas";
  6 
  7 const SUPPORTED_FORMULAS = [
  8   'ABS', 'ACCRINT', 'ACOS', 'ACOSH', 'ACOTH', 'AND', 'ARABIC', 'ASIN', 'ASINH', 'ATAN', 'ATAN2', 'ATANH', 'AVEDEV', 'AVERAGE', 'AVERAGEA', 'AVERAGEIF',
  9-  'BASE', 'BESSELI', 'BESSELJ', 'BESSELK', 'BESSELY', 'BETADIST', 'BETAINV', 'BIN2DEC', 'BIN2HEX', 'BIN2OCT', 'BINOMDIST', 'BINOMDISTRANGE', 'BINOMINV', 'BITAND', 'BITLSHIFT', 'BITOR', 'BITRSHIFT', 'BITXOR',
 10-  'CEILING', 'CEILINGMATH', 'CEILINGPRECISE', 'CHAR', 'CHISQDIST', 'CHISQINV', 'CODE', 'COMBIN', 'COMBINA', 'COMPLEX', 'CONCATENATE', 'CONFIDENCENORM', 'CONFIDENCET', 'CONVERT', 'CORREL', 'COS', 'COSH', 'COT', 'COTH', 'COUNT', 'COUNTA', 'COUNTBLANK', 'COUNTIF', 'COUNTIFS', 'COUNTIN', 'COUNTUNIQUE', 'COVARIANCEP', 'COVARIANCES', 'CSC', 'CSCH', 'CUMIPMT', 'CUMPRINC',
 11+  'BIN2DEC', 'BIN2HEX', 'BIN2OCT', 'BINOMDIST',
 12+  'CEILING', 'CHAR', 'CODE', 'COMBIN', 'COMBINA', 'COMPLEX', 'CONCATENATE', 'CONFIDENCE', 'CONVERT', 'CORREL', 'COS', 'COSH', 'COT', 'COTH', 'COUNT', 'COUNTA', 'COUNTBLANK', 'COUNTIF', 'COUNTIFS', 'COUNTUNIQUE', 'COVARIANCEP', 'COVARIANCES', 'CSC', 'CSCH', 'CUMIPMT', 'CUMPRINC',
 13   'DATE', 'DATEVALUE', 'DAY', 'DAYS', 'DAYS360', 'DB', 'DDB', 'DEC2BIN', 'DEC2HEX', 'DEC2OCT', 'DECIMAL', 'DEGREES', 'DELTA', 'DEVSQ', 'DOLLAR', 'DOLLARDE', 'DOLLARFR',
 14   'E', 'EDATE', 'EFFECT', 'EOMONTH', 'ERF', 'ERFC', 'EVEN', 'EXACT', 'EXPONDIST',
 15   'FALSE', 'FDIST', 'FINV', 'FISHER', 'FISHERINV',
 16diff --git a/src/RawFormulas/RawFormulas.ts b/src/RawFormulas/RawFormulas.ts
 17index 2f8a7fa..b5404e4 100644
 18--- a/src/RawFormulas/RawFormulas.ts
 19+++ b/src/RawFormulas/RawFormulas.ts
 20@@ -71,33 +71,16 @@ import * as ERRORS from "../Errors"
 21 
 22 var ACCRINT = Formula["ACCRINT"];
 23 var AVERAGEIF = Formula["AVERAGEIF"];
 24-var BASE = Formula["BASE"];
 25 var BIN2DEC = Formula["BIN2DEC"];
 26-var BESSELI = Formula["BESSELI"];
 27-var BESSELJ = Formula["BESSELJ"];
 28-var BESSELK = Formula["BESSELK"];
 29-var BESSELY = Formula["BESSELY"];
 30-var BETADIST = Formula["BETADIST"];
 31-var BETAINV = Formula["BETAINV"];
 32-var BITAND = Formula["BITAND"];
 33-var BITLSHIFT = Formula["BITLSHIFT"];
 34-var BITOR = Formula["BITOR"];
 35-var BITRSHIFT = Formula["BITRSHIFT"];
 36-var BITXOR = Formula["BITXOR"];
 37 var BIN2HEX = Formula["BIN2HEX"];
 38 var BIN2OCT = Formula["BIN2OCT"];
 39 var DECIMAL = Formula["DECIMAL"];
 40 var CEILING = Formula["CEILING"];
 41-var CEILINGMATH = Formula["CEILINGMATH"];
 42-var CEILINGPRECISE = Formula["CEILINGPRECISE"];
 43 var COMBIN = Formula["COMBIN"];
 44-var COMBINA = Formula["COMBINA"];
 45-var COMPLEX = Formula["COMPLEX"];
 46 var CONCATENATE = Formula["CONCATENATE"];
 47 var CONVERT = Formula["CONVERT"];
 48 var CORREL = Formula["CORREL"];
 49 var COUNTIFS = Formula["COUNTIFS"];
 50-var COUNTIN = Formula["COUNTIN"];
 51 var COUNTUNIQUE = Formula["COUNTUNIQUE"];
 52 var COVARIANCEP = Formula["COVARIANCEP"];
 53 var COVARIANCES = Formula["COVARIANCES"];
 54@@ -372,30 +355,14 @@ export {
 55   AVERAGE,
 56   AVERAGEA,
 57   AVERAGEIF,
 58-  BASE,
 59   BIN2DEC,
 60-  BESSELI,
 61-  BESSELJ,
 62-  BESSELK,
 63-  BESSELY,
 64-  BETADIST,
 65-  BETAINV,
 66-  BITAND,
 67-  BITLSHIFT,
 68-  BITOR,
 69-  BITRSHIFT,
 70-  BITXOR,
 71   BIN2HEX,
 72   BIN2OCT,
 73   DECIMAL,
 74   CEILING,
 75-  CEILINGMATH,
 76-  CEILINGPRECISE,
 77   CHAR,
 78   CODE,
 79   COMBIN,
 80-  COMBINA,
 81-  COMPLEX,
 82   CONCATENATE,
 83   CONVERT,
 84   CORREL,
 85@@ -408,7 +375,6 @@ export {
 86   COUNTA,
 87   COUNTIF,
 88   COUNTIFS,
 89-  COUNTIN,
 90   COUNTUNIQUE,
 91   COVARIANCEP,
 92   COVARIANCES,
 93diff --git a/tests/FormulasTest.ts b/tests/FormulasTest.ts
 94index b1c5356..162ab72 100644
 95--- a/tests/FormulasTest.ts
 96+++ b/tests/FormulasTest.ts
 97@@ -1,8 +1,7 @@
 98 import { ABS, ACCRINT, ACOS, ACOSH, ACOTH, AND, ARABIC, ASIN, ASINH, ATAN, ATAN2, ATANH, AVEDEV, AVERAGE,
 99-    AVERAGEA, AVERAGEIF, BASE, BIN2DEC, BESSELI, BESSELJ, BESSELK, BESSELY, BETADIST, BETAINV,
100-    BITAND, BITLSHIFT, BITOR, BITRSHIFT, BITXOR, BIN2HEX, BIN2OCT, DECIMAL, CEILING,
101-    CEILINGMATH, CEILINGPRECISE, CHAR, CODE, COMBIN, COMBINA, COMPLEX, CONCATENATE, CONVERT,
102-    CORREL, COS, PI, COSH, COT, COTH, COUNT, COUNTA, COUNTIF, COUNTIFS, COUNTIN, COUNTUNIQUE,
103+    AVERAGEA, AVERAGEIF, BIN2DEC, BIN2HEX, BIN2OCT, DECIMAL, CEILING,
104+    CHAR, CODE, COMBIN, CONCATENATE, CONVERT,
105+    CORREL, COS, PI, COSH, COT, COTH, COUNT, COUNTA, COUNTIF, COUNTIFS, COUNTUNIQUE,
106     COVARIANCEP, COVARIANCES, CSC, CSCH, CUMIPMT, CUMPRINC, DATE, DATEVALUE, DAY, DAYS, DAYS360,
107     DB, DDB, DEC2BIN, DEC2HEX, DEC2OCT, DEGREES, DELTA, DEVSQ, DOLLAR, DOLLARDE, DOLLARFR, EDATE,
108     EFFECT, EOMONTH, ERF, ERFC, EVEN, EXACT, EXPONDIST, FALSE, __COMPLEX, FISHER, FISHERINV, IF,
109@@ -261,32 +260,8 @@ catchAndAssertEquals(function() {
110 
111 assertEquals(AVERAGEIF([1, 5, 10], '>2'), 7.5);
112 
113-assertEquals(BASE(15, 2, 10), '0000001111');
114-
115 assertEquals(BIN2DEC(1010101010), -342);
116 
117-assertEquals(BESSELI(1, 2), 0.13574766658069928);
118-
119-assertEquals(BESSELJ(1, 2), 0.11490348499246938);
120-
121-assertEquals(BESSELK(1, 2), 1.6248388844172295);
122-
123-assertEquals(BESSELY(1, 2), -1.6506826133039476);
124-
125-assertEquals(BETADIST(2, 8, 10, true, 1, 3), 0.6854705810117458);
126-
127-assertEquals(BETAINV(0.6854705810117458, 8, 10, 1, 3), 1.9999999999999996);
128-
129-assertEquals(BITAND(42, 24), 8);
130-
131-assertEquals(BITLSHIFT(42, 24), 704643072);
132-
133-assertEquals(BITOR(42, 24), 58);
134-
135-assertEquals(BITRSHIFT(42, 2), 10);
136-
137-assertEquals(BITXOR(42, 24), 50);
138-
139 assertEquals(BIN2HEX(1010101010), "fffffffeaa");
140 
141 assertEquals(BIN2OCT(1010101010), "7777777252");
142@@ -295,11 +270,6 @@ assertEquals(DECIMAL(199.99999), 199);
143 
144 assertEquals(CEILING(22.22, 0.1), 22.3);
145 
146-assertEquals(CEILINGMATH(1001.112131), 1002);
147-
148-assertEquals(CEILINGPRECISE(1001.112131), 1002);
149-
150-
151 // Test CHAR
152 assertEquals(CHAR(97), "a");
153 assertEquals(CHAR("97"), "a");
154@@ -344,10 +314,6 @@ assertEquals(CODE([['a'], 'p']), 97);
155 
156 assertEquals(COMBIN(4, 2), 6);
157 
158-assertEquals(COMBINA(4, 3), 20);
159-
160-assertEquals(COMPLEX(3, 4), '3+4i');
161-
162 assertEquals(CONCATENATE("hey", " ", "there"), "hey there");
163 
164 assertEquals(CONVERT(5.1, "mm", "m"), 0.0050999999999999995);
165@@ -511,8 +477,6 @@ catchAndAssertEquals(function() {
166 
167 assertEquals(COUNTIFS([1, 5, 10], ">4", [1, 5, 10], ">4"), 2);
168 
169-assertEquals(COUNTIN([1,3,1],1), 2);
170-
171 assertEquals(COUNTUNIQUE([1, 1, 10]), 2);
172 
173 assertEquals(COVARIANCEP([3,2,4,5,6], [9,7,12,15,17]), 5.2);
174diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
175index 30039a0..f2fbf4e 100644
176--- a/tests/SheetFormulaTest.ts
177+++ b/tests/SheetFormulaTest.ts
178@@ -80,53 +80,13 @@ testFormula("=AVERAGEA(10, 20, 4.1)", 11.366666666666667);
179 // Test AVERAGEIF
180 testFormula("=AVERAGEIF([1, 5, 10], '>2')", 7.5);
181 
182-// Test BASE
183-testFormula('=BASE(15, 2, 10)', '0000001111');
184-
185 // Test BIN2DEC
186 testFormula("=BIN2DEC(1010101010)", -342);
187 
188-// Test BESSELI
189-testFormula('=BESSELI(1, 2)', 0.13574766658069928);
190-
191-// Test BESSELJ
192-testFormula('=BESSELJ(1, 2)', 0.11490348499246938);
193-
194-// Test BESSELK
195-testFormula('=BESSELK(1, 2)', 1.6248388844172295);
196-
197-// Test BESSELY
198-testFormula('=BESSELY(1, 2)', -1.6506826133039476);
199-
200-// Test BETADIST
201-testFormula('=BETADIST(2, 8, 10, true, 1, 3)', 0.6854705810117458);
202-
203-// Test BETAINV
204-testFormula('=BETAINV(0.6854705810117458, 8, 10, 1, 3)', 1.9999999999999996);
205-
206-// Test BINOMDISTRANGE
207-// TODO: This should work.
208-// testFormula('=BINOMDISTRANGE(60, 0.75, 45, 50)', 0.52363);
209-
210 // Test BINOMINV
211 // TODO: This should work.
212 // testFormula('=BINOMINV(6, 0.5, 0.75)', 4);
213 
214-// Test BITAND
215-testFormula('=BITAND(42, 24)', 8);
216-
217-// Test BITLSHIFT
218-testFormula('=BITLSHIFT(42, 24)', 704643072);
219-
220-// Test BITOR
221-testFormula('=BITOR(42, 24)', 58);
222-
223-// Test BITRSHIFT
224-testFormula('=BITRSHIFT(42, 2)', 10);
225-
226-// Test BITXOR
227-testFormula('=BITXOR(42, 24)', 50);
228-
229 // Test BIN2HEX
230 testFormula("=BIN2HEX(1010101010)", "fffffffeaa");
231 
232@@ -142,20 +102,6 @@ testFormula('=DECIMAL(199.99999)', 199);
233 // Test CEIL
234 testFormula("=CEILING(22.22, 0.1)", 22.3);
235 
236-// Test CEILINGMATH
237-testFormula('=CEILINGMATH(1001.112131)', 1002);
238-
239-// Test CEILINGPRECISE
240-testFormula('=CEILINGPRECISE(1001.112131)', 1002);
241-
242-// Test CHISQDIST
243-// TODO: This should work.
244-// testFormula('=CHISQDIST(0.5, 1, true)', 55);
245-
246-// Test CHISQINV
247-// TODO: This should work.
248-// testFormula('=CHISQINV(0.5, 1, true)', 44);
249-
250 // Test CHAR
251 testFormula("=CHAR(97)", "a");
252 
253@@ -165,23 +111,13 @@ testFormula("=CODE('a')", 97);
254 // Test COMBIN
255 testFormula("=COMBIN(4, 2)", 6);
256 
257-// Test COMBINA
258-testFormula('=COMBINA(4, 3)', 20);
259-
260-// Test COMPLEX
261-testFormula('=COMPLEX(3, 4)', '3+4i');
262-
263 // Test CONCATENATE
264 testFormula('=CONCATENATE("hey", " ", "there")', "hey there");
265 
266-// Test CONFIDENCENORM
267+// Test CONFIDENCE
268 // TODO: This should work.
269 // testFormula('=CONFIDENCE(0.05, 1.6, 250)', 0.1983344105);
270 
271-// Test CONFIDENCET
272-// TODO: This should work.
273-// testFormula('=CONFIDENCET(0.05, 1, 50)', 0.2842);
274-
275 // Test CONVERT
276 testFormula('=CONVERT(5.1, "mm", "m")', 0.0050999999999999995);
277 
278@@ -215,9 +151,6 @@ testFormula('=COUNTIF([1, 5, 10], ">4")', 2);
279 // Test COUNTIFS
280 testFormula('=COUNTIFS([1, 5, 10], ">4", [1, 5, 10], ">4")', 2);
281 
282-// Test COUNTIN
283-testFormula('=COUNTIN([1,3,1],1)', 2);
284-
285 // Test COUNTUNIQUE
286 testFormula('=COUNTUNIQUE([1, 1, 10])', 2);
287