2015-04-11 23:09:05 +00:00
|
|
|
/*
|
|
|
|
|
*
|
|
|
|
|
* Utils (utils.js)
|
|
|
|
|
* Author: rtfpessoa
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2015-07-19 21:08:17 +00:00
|
|
|
(function (ctx, undefined) {
|
2015-04-11 23:09:05 +00:00
|
|
|
|
2015-04-12 01:59:54 +00:00
|
|
|
function Utils() {
|
|
|
|
|
}
|
2015-04-11 23:09:05 +00:00
|
|
|
|
2015-04-12 01:59:54 +00:00
|
|
|
Utils.prototype.escape = function (str) {
|
|
|
|
|
return str.slice(0)
|
|
|
|
|
.replace(/&/g, "&")
|
|
|
|
|
.replace(/</g, "<")
|
|
|
|
|
.replace(/>/g, ">")
|
|
|
|
|
.replace(/\t/g, " ");
|
|
|
|
|
};
|
2015-04-11 23:09:05 +00:00
|
|
|
|
2015-04-12 01:59:54 +00:00
|
|
|
Utils.prototype.startsWith = function (str, start) {
|
|
|
|
|
return str.indexOf(start) === 0;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Utils.prototype.valueOrEmpty = function (value) {
|
|
|
|
|
return value ? value : "";
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-19 21:08:17 +00:00
|
|
|
// expose this module
|
|
|
|
|
((typeof module !== 'undefined' && module.exports) ||
|
|
|
|
|
(typeof exports !== 'undefined' && exports) ||
|
|
|
|
|
(typeof window !== 'undefined' && window) ||
|
|
|
|
|
(typeof self !== 'undefined' && self) ||
|
|
|
|
|
(typeof $this !== 'undefined' && $this) ||
|
|
|
|
|
Function('return this')())["Utils"] = new Utils();
|
2015-04-12 01:59:54 +00:00
|
|
|
|
|
|
|
|
})(this);
|