mirror of
https://github.com/ntop/ntopng.git
synced 2026-05-01 00:19:33 +00:00
parent
c40f854283
commit
4e31f600f6
118 changed files with 34006 additions and 10177 deletions
|
|
@ -1,42 +1,41 @@
|
|||
// 2014-20 - ntop.org
|
||||
|
||||
String.prototype.capitalizeSingleWord = function() {
|
||||
const uc = this.toUpperCase();
|
||||
String.prototype.capitalizeSingleWord = function () {
|
||||
var uc = this.toUpperCase();
|
||||
|
||||
if ((uc == 'ASN') || (uc == 'OS')) {
|
||||
return (uc);
|
||||
} else {
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
};
|
||||
if ((uc == "ASN") || (uc == "OS"))
|
||||
return (uc);
|
||||
else
|
||||
return this.charAt(0).toUpperCase() + this.slice(1);
|
||||
}
|
||||
|
||||
String.prototype.capitalize = function() {
|
||||
const res = this.split(' ');
|
||||
String.prototype.capitalize = function () {
|
||||
var res = this.split(" ");
|
||||
|
||||
for (const i in res) {
|
||||
res[i] = res[i].capitalizeSingleWord();
|
||||
}
|
||||
for (var i in res) {
|
||||
res[i] = res[i].capitalizeSingleWord();
|
||||
}
|
||||
|
||||
return (res.join(' '));
|
||||
};
|
||||
return (res.join(" "));
|
||||
}
|
||||
|
||||
String.prototype.startsWith = function(string) {
|
||||
return (this.indexOf(string) === 0);
|
||||
String.prototype.startsWith = function (string) {
|
||||
return (this.indexOf(string) === 0);
|
||||
};
|
||||
|
||||
// "{0} to {1}".sformat(1, 10) -> "1 to 10"
|
||||
String.prototype.sformat = function() {
|
||||
const args = arguments;
|
||||
let curr_arg = -1;
|
||||
return this.replace(/(\%\{.*?\})/gi, function(match) {
|
||||
curr_arg = curr_arg + 1;
|
||||
String.prototype.sformat = function () {
|
||||
let args = arguments;
|
||||
let curr_arg = -1;
|
||||
return this.replace(/(\%\{.*?\})/gi, function (match) {
|
||||
curr_arg = curr_arg + 1;
|
||||
return typeof args[curr_arg] != 'undefined' ? args[curr_arg] : match;
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
if (typeof (String.prototype.contains) === 'undefined') {
|
||||
String.prototype.contains = function(s) {
|
||||
return this.indexOf(s) !== -1;
|
||||
};
|
||||
if (typeof (String.prototype.contains) === "undefined") {
|
||||
String.prototype.contains = function (s) {
|
||||
return this.indexOf(s) !== -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue