spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
Engineering.ts refactoring done.
author
Ben Vogt <[email protected]>
date
2017-02-20 22:40:48
stats
3 file(s) changed, 18 insertions(+), 21 deletions(-)
files
src/RawFormulas/Engineering.ts
src/RawFormulas/Math.ts
src/RawFormulas/RawFormulas.ts
 1diff --git a/src/RawFormulas/Engineering.ts b/src/RawFormulas/Engineering.ts
 2index 5da4703..576f392 100644
 3--- a/src/RawFormulas/Engineering.ts
 4+++ b/src/RawFormulas/Engineering.ts
 5@@ -287,6 +287,20 @@ var DEC2BIN = function (...values) : string {
 6   }
 7 };
 8 
 9+/**
10+ * Compare two numeric values, returning 1 if they're equal.
11+ * @param values[0] The first number to compare.
12+ * @param values[1] The second number to compare.
13+ * @returns {number} 1 if they're equal, 0 if they're not equal.
14+ * @constructor
15+ */
16+var DELTA = function (...values) : number {
17+  ArgsChecker.checkLengthWithin(values, 1, 2);
18+  if (values.length === 1) {
19+    return TypeCaster.valueToNumber(values[0]) === 0 ? 1 : 0;
20+  }
21+  return TypeCaster.valueToNumber(values[0]) === TypeCaster.valueToNumber(values[1]) ? 1 : 0;
22+};
23 
24 export {
25   BIN2DEC,
26@@ -294,5 +308,6 @@ export {
27   BIN2OCT,
28   DEC2BIN,
29   DEC2HEX,
30-  DEC2OCT
31+  DEC2OCT,
32+  DELTA
33 }
34\ No newline at end of file
35diff --git a/src/RawFormulas/Math.ts b/src/RawFormulas/Math.ts
36index f2342aa..62f9597 100644
37--- a/src/RawFormulas/Math.ts
38+++ b/src/RawFormulas/Math.ts
39@@ -777,21 +777,6 @@ var COUNTA = function (...values) : number {
40   return count;
41 };
42 
43-/**
44- * Compare two numeric values, returning 1 if they're equal.
45- * @param values[0] The first number to compare.
46- * @param values[1] The second number to compare.
47- * @returns {number} 1 if they're equal, 0 if they're not equal.
48- * @constructor
49- */
50-var DELTA = function (...values) : number {
51-  ArgsChecker.checkLengthWithin(values, 1, 2);
52-  if (values.length === 1) {
53-    return TypeCaster.valueToNumber(values[0]) === 0 ? 1 : 0;
54-  }
55-  return TypeCaster.valueToNumber(values[0]) === TypeCaster.valueToNumber(values[1]) ? 1 : 0;
56-};
57-
58 /**
59  * Rounds a number to a certain number of decimal places according to standard rules.
60  * @param values[0] The value to round to places number of places.
61@@ -1768,7 +1753,6 @@ export {
62   SUMX2PY2, // Array?
63   FLOOR,
64   IF,
65-  DELTA, // Engineering
66   COUNT, // Statistical
67   COUNTA, // Statistical
68   COUNTIF,
69diff --git a/src/RawFormulas/RawFormulas.ts b/src/RawFormulas/RawFormulas.ts
70index 5a57644..e78c15c 100644
71--- a/src/RawFormulas/RawFormulas.ts
72+++ b/src/RawFormulas/RawFormulas.ts
73@@ -60,7 +60,6 @@ import {
74   SUMX2PY2,
75   FLOOR,
76   IF,
77-  DELTA,
78   COUNT,
79   COUNTA,
80   COUNTIF,
81@@ -86,7 +85,8 @@ import {
82   BIN2OCT,
83   DEC2BIN,
84   DEC2HEX,
85-  DEC2OCT
86+  DEC2OCT,
87+  DELTA
88 } from "./Engineering";
89 import {
90   DOLLAR,