-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUtil.js
31 lines (25 loc) · 888 Bytes
/
Util.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/*
General dumping ground for misc functions that I can't find a better place for.
Warning: Don't look at this too closely, or you may loose your sanity.
Side Note: Putting these all in one place may not have been a good idea.
I think they're breeding. There seem to be more functions in here that I didn't create.
*/
"use strict";
class Util {
constructor() {
}
static isNullOrEmpty(s) {
return ((s == null) || Util.isStringWhiteSpace(s));
}
static isStringWhiteSpace(s) {
return !(/\S/.test(s));
}
static labelElementWithSource(element, source) {
element.setAttribute("source", source);
let span = document.createElement("span");
span.className = "source";
span.appendChild(document.createTextNode("(" + source + ")"));
element.prepend(span);
return element;
}
}