generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
/
destination.js
38 lines (30 loc) · 852 Bytes
/
destination.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
class Destination {
constructor(rawDestination) {
for (const keyValuePair of rawDestination.split(',')) {
const pair = keyValuePair.split('=');
this[pair[0].toLowerCase()] = pair[1];
}
}
matchesRuntime(specifier) {
const parts = specifier.split('.');
const [platform, ...osParts] = parts[parts.length - 1].split('-');
const os = osParts.join('.');
if (this.platform != undefined && this.platform.split(' ')[0] != platform) {
return false;
}
if (this.os != undefined && this.os != os) {
return false;
}
return true;
}
matchesDevice(device) {
if (this.uuid != undefined && this.uuid != device.uuid) {
return false;
}
if (this.name != undefined && this.name != device.name) {
return false;
}
return false;
}
}
module.exports = Destination