commit
message
[EXACT, TypeCaster] making exact smarter, making TypeCaster have one less assumption
author
Ben Vogt <[email protected]>
date
2017-05-04 03:15:08
stats
2 file(s) changed,
3 insertions(+),
17 deletions(-)
files
src/Formulas/Logical.ts
src/Utilities/TypeCaster.ts
1diff --git a/src/Formulas/Logical.ts b/src/Formulas/Logical.ts
2index 1e7b968..313a852 100644
3--- a/src/Formulas/Logical.ts
4+++ b/src/Formulas/Logical.ts
5@@ -46,21 +46,9 @@ var AND = function (...values) {
6 */
7 var EXACT = function (...values) {
8 ArgsChecker.checkLength(values, 2);
9- var one = values[0];
10- var two = values[1];
11- if (one instanceof Array) {
12- if (one.length === 0) {
13- throw new RefError("Reference does not exist.");
14- }
15- }
16- if (two instanceof Array) {
17- if (two.length === 0) {
18- throw new RefError("Reference does not exist.");
19- }
20- }
21- one = TypeCaster.valueToString(one);
22- two = TypeCaster.valueToString(two);
23- return one === two;
24+ var one = TypeCaster.firstValue(values[0]);
25+ var two = TypeCaster.firstValue(values[1]);
26+ return one.toString() === two.toString();
27 };
28
29 /**
30diff --git a/src/Utilities/TypeCaster.ts b/src/Utilities/TypeCaster.ts
31index 119c6b8..5b9f1d9 100644
32--- a/src/Utilities/TypeCaster.ts
33+++ b/src/Utilities/TypeCaster.ts
34@@ -405,8 +405,6 @@ class TypeCaster {
35 return value;
36 } else if (typeof value === "boolean") {
37 return value ? "TRUE" : "FALSE";
38- } else if (value instanceof Array) {
39- return this.valueToString(value[0]); // TODO: Take this out. It's stupid. We should handle arrays at a different level.
40 }
41 }
42