-
Notifications
You must be signed in to change notification settings - Fork 1
/
utils.js
54 lines (51 loc) · 1.48 KB
/
utils.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
export function cleanPropertyName(k) {
return k
// convert to lower case
.toLowerCase()
// remove leading slash
.replace(/^\//, "")
// replace all slashes and dots with _
.replace(/\/|\.|-| /g, "_")
;
}
export function isStringDDMMYYYYHHMM(dt){
var reDate = /^((0?[1-9]|[12][0-9]|3[01])[- /.](0?[1-9]|1[012])[- /.](19|20)?[0-9]{2}[ ][012][0-9][:][0-9]{2})*$/;
return reDate.test(dt);
}
export function isDemo(url) {
if (
(url.includes('://london.my-netdata.io'))
||
(url.includes('://london3.my-netdata.io'))
||
(url.includes('://cdn77.my-netdata.io'))
||
(url.includes('://octopuscs.my-netdata.io'))
||
(url.includes('://bangalore.my-netdata.io'))
||
(url.includes('://frankfurt.my-netdata.io'))
||
(url.includes('://newyork.my-netdata.io'))
||
(url.includes('://sanfrancisco.my-netdata.io'))
||
(url.includes('://singapore.my-netdata.io'))
||
(url.includes('://toronto.my-netdata.io'))
){
return true
} else {
return false
}
}
export function splitPathName(event) {
if (event.properties['$pathname']) {
event.properties["$pathname"].split("/").forEach((pathname, index) => {
if ((pathname !== "") && (pathname !== null)){
event.properties[`pathname_${index}`] = pathname
}
})
}
return event
}