aboutsummaryrefslogtreecommitdiff
path: root/js/helper-classes/Utils.js
diff options
context:
space:
mode:
authorValerio Virgillito2012-02-13 21:43:51 -0800
committerValerio Virgillito2012-02-13 21:43:51 -0800
commit081f17954c735fc8b946d72a25b0ee60d370ef9b (patch)
treede7b50f2d02365df897ef4356f953d3833c9cabd /js/helper-classes/Utils.js
parent47df0aff81c25334b129047bb227ea5015357eda (diff)
parent1d82f1a041612f32bbf6c9f20d9fb14e2d11fcc7 (diff)
downloadninja-081f17954c735fc8b946d72a25b0ee60d370ef9b.tar.gz
Merge branch 'refs/heads/master' into components
Conflicts: js/components/treeview/ninja-leaf.reel/ninja-leaf.js Signed-off-by: Valerio Virgillito <valerio@motorola.com>
Diffstat (limited to 'js/helper-classes/Utils.js')
-rw-r--r--js/helper-classes/Utils.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/js/helper-classes/Utils.js b/js/helper-classes/Utils.js
deleted file mode 100644
index 1cfc390e..00000000
--- a/js/helper-classes/Utils.js
+++ /dev/null
@@ -1,33 +0,0 @@
1/* <copyright>
2This file contains proprietary software owned by Motorola Mobility, Inc.<br/>
3No rights, expressed or implied, whatsoever to this software are provided by Motorola Mobility, Inc. hereunder.<br/>
4(c) Copyright 2011 Motorola Mobility, Inc. All Rights Reserved.
5</copyright> */
6
7// Adding to the String Prototype little utility function to capitalize the first Char of a String.
8String.prototype.capitalizeFirstChar = function() {
9 return this.charAt(0).toUpperCase() + this.slice(1);
10};
11
12exports.utils = Object.create(Object.prototype, {
13
14 getValueAndUnits: {
15 value: function(str)
16 {
17 var numberValue = parseFloat(str);
18 // Ignore all whitespace, digits, negative sign and "." when looking for units label
19 // The units must come after one or more digits
20 var objRegExp = /(\-*\d+\.*\d*)(\s*)(\w*\%*)/;
21 var unitsString = str.replace(objRegExp, "$3");
22 if(unitsString)
23 {
24 var noSpaces = /(\s*)(\S*)(\s*)/;
25 // strip out spaces and convert to lower case
26 var match = (unitsString.replace(noSpaces, "$2")).toLowerCase();
27 }
28
29 return [numberValue, match];
30 }
31 }
32
33}); \ No newline at end of file