spreadsheet
typeScript/javascript spreadsheet parser, with formulas.
git clone https://git.vogt.world/spreadsheet.git
Log | Files | README.md
← Commit log
commit
message
[ISNONTEXT] formula added and tested
author
Ben Vogt <[email protected]>
date
2017-06-16 00:24:10
stats
8 file(s) changed, 56 insertions(+), 6 deletions(-)
files
DOCS.md
TODO.md
dist/Formulas/AllFormulas.js
dist/Formulas/Info.js
src/Formulas/AllFormulas.ts
src/Formulas/Info.ts
tests/Formulas/InfoTest.ts
tests/SheetFormulaTest.ts
  1diff --git a/DOCS.md b/DOCS.md
  2index 99293ee..59b3924 100644
  3--- a/DOCS.md
  4+++ b/DOCS.md
  5@@ -455,6 +455,15 @@
  6 @constructor
  7 ```
  8 
  9+### ISNONTEXT 
 10+
 11+```
 12+  Returns true if a value is not text. 
 13+@param value - value or reference to check. 
 14+@returns {boolean}. 
 15+@constructor
 16+```
 17+
 18 ### ISLOGICAL 
 19 
 20 ```
 21diff --git a/TODO.md b/TODO.md
 22index 4a96f22..035cf01 100644
 23--- a/TODO.md
 24+++ b/TODO.md
 25@@ -32,7 +32,6 @@ For example 64 tbs to a qt.
 26 * ISERROR
 27 * ISFORMULA
 28 * ISNA
 29-* ISNONTEXT
 30 * ISREF
 31 * ISURL
 32 * N
 33diff --git a/dist/Formulas/AllFormulas.js b/dist/Formulas/AllFormulas.js
 34index c9494b9..4b97f3e 100644
 35--- a/dist/Formulas/AllFormulas.js
 36+++ b/dist/Formulas/AllFormulas.js
 37@@ -76,6 +76,7 @@ exports.NA = Info_1.NA;
 38 exports.ISTEXT = Info_1.ISTEXT;
 39 exports.ISLOGICAL = Info_1.ISLOGICAL;
 40 exports.ISNUMBER = Info_1.ISNUMBER;
 41+exports.ISNONTEXT = Info_1.ISNONTEXT;
 42 var Lookup_1 = require("./Lookup");
 43 exports.CHOOSE = Lookup_1.CHOOSE;
 44 var Logical_1 = require("./Logical");
 45diff --git a/dist/Formulas/Info.js b/dist/Formulas/Info.js
 46index aba3f1f..743a4d4 100644
 47--- a/dist/Formulas/Info.js
 48+++ b/dist/Formulas/Info.js
 49@@ -23,6 +23,17 @@ var ISTEXT = function (value) {
 50     return typeof TypeConverter_1.TypeConverter.firstValue(value) === "string";
 51 };
 52 exports.ISTEXT = ISTEXT;
 53+/**
 54+ * Returns true if a value is not text.
 55+ * @param value - value or reference to check.
 56+ * @returns {boolean}.
 57+ * @constructor
 58+ */
 59+var ISNONTEXT = function (value) {
 60+    ArgsChecker_1.ArgsChecker.checkLength(arguments, 1, "ISNONTEXT");
 61+    return typeof TypeConverter_1.TypeConverter.firstValue(value) !== "string";
 62+};
 63+exports.ISNONTEXT = ISNONTEXT;
 64 /**
 65  * Returns true if value is a boolean (FALSE, or TRUE). Numerical and text values return false.
 66  * @param value - value or reference to check.
 67diff --git a/src/Formulas/AllFormulas.ts b/src/Formulas/AllFormulas.ts
 68index cf47640..eec1248 100644
 69--- a/src/Formulas/AllFormulas.ts
 70+++ b/src/Formulas/AllFormulas.ts
 71@@ -74,7 +74,8 @@ import {
 72   NA,
 73   ISTEXT,
 74   ISLOGICAL,
 75-  ISNUMBER
 76+  ISNUMBER,
 77+  ISNONTEXT
 78 } from "./Info";
 79 import {
 80   CHOOSE
 81@@ -333,5 +334,6 @@ export {
 82   STDEVPA,
 83   ISTEXT,
 84   ISLOGICAL,
 85-  ISNUMBER
 86+  ISNUMBER,
 87+  ISNONTEXT
 88 }
 89\ No newline at end of file
 90diff --git a/src/Formulas/Info.ts b/src/Formulas/Info.ts
 91index 1ec1248..f369500 100644
 92--- a/src/Formulas/Info.ts
 93+++ b/src/Formulas/Info.ts
 94@@ -31,6 +31,18 @@ var ISTEXT =  function (value) {
 95 };
 96 
 97 
 98+/**
 99+ * Returns true if a value is not text.
100+ * @param value - value or reference to check.
101+ * @returns {boolean}.
102+ * @constructor
103+ */
104+var ISNONTEXT = function (value) {
105+  ArgsChecker.checkLength(arguments, 1, "ISNONTEXT");
106+  return typeof TypeConverter.firstValue(value) !== "string";
107+};
108+
109+
110 /**
111  * Returns true if value is a boolean (FALSE, or TRUE). Numerical and text values return false.
112  * @param value - value or reference to check.
113@@ -59,5 +71,6 @@ export {
114   NA,
115   ISTEXT,
116   ISLOGICAL,
117-  ISNUMBER
118+  ISNUMBER,
119+  ISNONTEXT
120 }
121\ No newline at end of file
122diff --git a/tests/Formulas/InfoTest.ts b/tests/Formulas/InfoTest.ts
123index c033175..c157726 100644
124--- a/tests/Formulas/InfoTest.ts
125+++ b/tests/Formulas/InfoTest.ts
126@@ -2,7 +2,8 @@ import {
127   NA,
128   ISTEXT,
129   ISLOGICAL,
130-  ISNUMBER
131+  ISNUMBER,
132+  ISNONTEXT
133 } from "../../src/Formulas/Info";
134 import * as ERRORS from "../../src/Errors";
135 import {
136@@ -47,3 +48,13 @@ test("ISNUMBER", function(){
137     ISNUMBER.apply(this, []);
138   }, ERRORS.NA_ERROR);
139 });
140+
141+test("ISNONTEXT", function(){
142+  assertEquals(ISNONTEXT("str"), false);
143+  assertEquals(ISNONTEXT(["str"]), false);
144+  assertEquals(ISNONTEXT(9), true);
145+  assertEquals(ISNONTEXT(false), true);
146+  catchAndAssertEquals(function() {
147+    ISNONTEXT.apply(this, []);
148+  }, ERRORS.NA_ERROR);
149+});
150diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
151index 611e1aa..afd89c8 100644
152--- a/tests/SheetFormulaTest.ts
153+++ b/tests/SheetFormulaTest.ts
154@@ -659,6 +659,10 @@ test("Sheet ISTEXT", function(){
155   assertFormulaEquals('=ISTEXT("str")', true);
156 });
157 
158+test("Sheet ISNONTEXT", function(){
159+  assertFormulaEquals('=ISNONTEXT("str")', false);
160+});
161+
162 test("Sheet ISLOGICAL", function(){
163   assertFormulaEquals('=ISLOGICAL(true)', true);
164 });