00001
00002 (function() {
00003 "use strict";
00004 var prefixMatch;
00005
00006 prefixMatch = new RegExp(/(?!xmlns)^.*:/);
00007
00008 exports.normalize = function(str) {
00009 return str.toLowerCase();
00010 };
00011
00012 exports.firstCharLowerCase = function(str) {
00013 return str.charAt(0).toLowerCase() + str.slice(1);
00014 };
00015
00016 exports.stripPrefix = function(str) {
00017 return str.replace(prefixMatch, '');
00018 };
00019
00020 exports.parseNumbers = function(str) {
00021 if (!isNaN(str)) {
00022 str = str % 1 === 0 ? parseInt(str, 10) : parseFloat(str);
00023 }
00024 return str;
00025 };
00026
00027 exports.parseBooleans = function(str) {
00028 if (/^(?:true|false)$/i.test(str)) {
00029 str = str.toLowerCase() === 'true';
00030 }
00031 return str;
00032 };
00033
00034 }).call(this);