commit
message
[UPPER] formula added and tested
author
Ben Vogt <[email protected]>
date
2017-06-23 23:50:39
stats
8 file(s) changed,
58 insertions(+),
7 deletions(-)
files
DOCS.md
TODO.md
dist/Formulas/AllFormulas.js
dist/Formulas/Text.js
src/Formulas/AllFormulas.ts
src/Formulas/Text.ts
tests/Formulas/TextTest.ts
tests/SheetFormulaTest.ts
1diff --git a/DOCS.md b/DOCS.md
2index be16712..5cff1f3 100644
3--- a/DOCS.md
4+++ b/DOCS.md
5@@ -1593,3 +1593,11 @@
6 @param value - Text to convert.
7 @constructor
8 ```
9+
10+### UPPER
11+
12+```
13+ Converts text to uppercase.
14+@param value - Text to convert.
15+@constructor
16+```
17diff --git a/TODO.md b/TODO.md
18index ad1d1c8..0f50539 100644
19--- a/TODO.md
20+++ b/TODO.md
21@@ -125,7 +125,6 @@ For example 64 tbs to a qt.
22 * SUBSTITUTE
23 * T
24 * TEXT
25-* UPPER
26 * VALUE
27 * LINEST
28 * LOGEST
29diff --git a/dist/Formulas/AllFormulas.js b/dist/Formulas/AllFormulas.js
30index 6856fe6..c4fac8f 100644
31--- a/dist/Formulas/AllFormulas.js
32+++ b/dist/Formulas/AllFormulas.js
33@@ -146,6 +146,7 @@ exports.CONCATENATE = Text_1.CONCATENATE;
34 exports.CONVERT = Text_1.CONVERT;
35 exports.TRIM = Text_1.TRIM;
36 exports.LOWER = Text_1.LOWER;
37+exports.UPPER = Text_1.UPPER;
38 var Date_1 = require("./Date");
39 exports.DATE = Date_1.DATE;
40 exports.DATEVALUE = Date_1.DATEVALUE;
41diff --git a/dist/Formulas/Text.js b/dist/Formulas/Text.js
42index 5fb591f..84e9562 100644
43--- a/dist/Formulas/Text.js
44+++ b/dist/Formulas/Text.js
45@@ -431,3 +431,14 @@ var LOWER = function (value) {
46 return text.toLowerCase();
47 };
48 exports.LOWER = LOWER;
49+/**
50+ * Converts text to uppercase.
51+ * @param value - Text to convert.
52+ * @constructor
53+ */
54+var UPPER = function (value) {
55+ ArgsChecker_1.ArgsChecker.checkLength(arguments, 1, "UPPER");
56+ var text = TypeConverter_1.TypeConverter.firstValueAsString(value);
57+ return text.toUpperCase();
58+};
59+exports.UPPER = UPPER;
60diff --git a/src/Formulas/AllFormulas.ts b/src/Formulas/AllFormulas.ts
61index 06e1d6d..2e80054 100644
62--- a/src/Formulas/AllFormulas.ts
63+++ b/src/Formulas/AllFormulas.ts
64@@ -152,7 +152,8 @@ import {
65 CONCATENATE,
66 CONVERT,
67 TRIM,
68- LOWER
69+ LOWER,
70+ UPPER
71 } from "./Text"
72 import {
73 DATE,
74@@ -351,5 +352,6 @@ export {
75 GROWTH,
76 TRIMMEAN,
77 SLOPE,
78- LOWER
79+ LOWER,
80+ UPPER
81 }
82\ No newline at end of file
83diff --git a/src/Formulas/Text.ts b/src/Formulas/Text.ts
84index 774d04d..c5d5437 100644
85--- a/src/Formulas/Text.ts
86+++ b/src/Formulas/Text.ts
87@@ -451,6 +451,17 @@ var LOWER = function (value) {
88 };
89
90
91+/**
92+ * Converts text to uppercase.
93+ * @param value - Text to convert.
94+ * @constructor
95+ */
96+var UPPER = function (value) {
97+ ArgsChecker.checkLength(arguments, 1, "UPPER");
98+ var text = TypeConverter.firstValueAsString(value);
99+ return text.toUpperCase();
100+};
101+
102 export {
103 ARABIC,
104 CHAR,
105@@ -459,5 +470,6 @@ export {
106 CONCATENATE,
107 CONVERT,
108 TRIM,
109- LOWER
110+ LOWER,
111+ UPPER
112 }
113\ No newline at end of file
114diff --git a/tests/Formulas/TextTest.ts b/tests/Formulas/TextTest.ts
115index 84fab80..9adfc8b 100644
116--- a/tests/Formulas/TextTest.ts
117+++ b/tests/Formulas/TextTest.ts
118@@ -6,7 +6,8 @@ import {
119 SPLIT,
120 CONVERT,
121 TRIM,
122- LOWER
123+ LOWER,
124+ UPPER
125 } from "../../src/Formulas/Text";
126 import * as ERRORS from "../../src/Errors";
127 import {
128@@ -162,3 +163,16 @@ test("LOWER", function(){
129 LOWER.apply(this, ["test", 5]);
130 }, ERRORS.NA_ERROR);
131 });
132+
133+
134+test("UPPER", function(){
135+ assertEquals(UPPER("test"), "TEST");
136+ assertEquals(UPPER(5), "5");
137+ assertEquals(UPPER(false), "FALSE");
138+ catchAndAssertEquals(function() {
139+ UPPER.apply(this, []);
140+ }, ERRORS.NA_ERROR);
141+ catchAndAssertEquals(function() {
142+ UPPER.apply(this, ["test", 5]);
143+ }, ERRORS.NA_ERROR);
144+});
145diff --git a/tests/SheetFormulaTest.ts b/tests/SheetFormulaTest.ts
146index 1483ee9..f275ae4 100644
147--- a/tests/SheetFormulaTest.ts
148+++ b/tests/SheetFormulaTest.ts
149@@ -696,7 +696,11 @@ test("Sheet SLOPE", function(){
150 });
151
152 test("Sheet LOWER", function(){
153- assertFormulaEquals('=LOWER("str")', "str");
154+ assertFormulaEquals('=LOWER("STR")', "str");
155+});
156+
157+test("Sheet UPPER", function(){
158+ assertFormulaEquals('=UPPER("str")', "STR");
159 });
160
161 test("Sheet *", function(){