1 |
|
2 | (function() {
|
3 | "use strict";
|
4 | var prefixMatch;
|
5 |
|
6 | prefixMatch = new RegExp(/(?!xmlns)^.*:/);
|
7 |
|
8 | exports.normalize = function(str) {
|
9 | return str.toLowerCase();
|
10 | };
|
11 |
|
12 | exports.firstCharLowerCase = function(str) {
|
13 | return str.charAt(0).toLowerCase() + str.slice(1);
|
14 | };
|
15 |
|
16 | exports.stripPrefix = function(str) {
|
17 | return str.replace(prefixMatch, '');
|
18 | };
|
19 |
|
20 | exports.parseNumbers = function(str) {
|
21 | if (!isNaN(str)) {
|
22 | str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
|
23 | }
|
24 | return str;
|
25 | };
|
26 |
|
27 | exports.parseBooleans = function(str) {
|
28 | if (/^(?:true|false)$/i.test(str)) {
|
29 | str = str.toLowerCase() === 'true';
|
30 | }
|
31 | return str;
|
32 | };
|
33 |
|
34 | }).call(this);
|