26 lines
430 B
JavaScript
26 lines
430 B
JavaScript
|
|
/*
|
||
|
|
*
|
||
|
|
* Utils (utils.js)
|
||
|
|
* Author: rtfpessoa
|
||
|
|
*
|
||
|
|
*/
|
||
|
|
|
||
|
|
function Utils() {
|
||
|
|
}
|
||
|
|
|
||
|
|
Utils.prototype.escape = function (str) {
|
||
|
|
return str.slice(0)
|
||
|
|
.replace(/&/g, "&")
|
||
|
|
.replace(/</g, "<")
|
||
|
|
.replace(/>/g, ">")
|
||
|
|
.replace(/\t/g, " ");
|
||
|
|
};
|
||
|
|
|
||
|
|
Utils.prototype.startsWith = function (str, start) {
|
||
|
|
return str.indexOf(start) === 0;
|
||
|
|
};
|
||
|
|
|
||
|
|
Utils.prototype.valueOrEmpty = function (value) {
|
||
|
|
return value ? value : "";
|
||
|
|
};
|