-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (54 loc) · 1.75 KB
/
index.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
/****************************
*
* winqdev (aka Vikke)
* (c) 2023
* steamid-regex package
* under MIT License
*
****************************/
module.exports = {
/**
*
* @param {string} steamid Check for a SteamID fakeness
* @returns true if is an natural steamid, or false if is an fake steamid
*/
steamid(steamid) {
if(typeof steamid !== 'string') {
throw new Error('Not a string!');
};
return /^STEAM_\d:\d:\d+$/.test(steamid);
},
/**
*
* @param {string} steamid3 Check for a SteamID3 fakeness
* @returns true if is an natural steamid3, or false if is an fake steamid3
*/
steamid3(steamid3) {
if(typeof steamid3 !== 'string') {
throw new Error('Not a string!');
};
return /^\[U:1:[0-9]+\]$/.test(steamid3);
},
/**
*
* @param {string} steamid64 Check for a SteamID64 fakeness
* @returns true if is an natural steamid64, or false if is an fake steamid64
*/
steamid64(steamid64) {
if(typeof steamid64 !== 'string') {
throw new Error('Not a string!');
};
return /^(\d{17})$/.test(steamid64);
},
/**
*
* @param {string} steamlink Check for Steam's links fakeness
* @returns true if is an natural steam link, or false if is an fake steam link
*/
steamlink(steamlink) {
if(typeof steamlink !== 'string') {
throw new Error('Not a string!');
};
return /https?:\/\/(?:\w+\.)?steamcommunity\.com\/.*/.test(steamlink) ? /https?:\/\/(?:\w+\.)?steamcommunity\.com\/.*/.test(steamlink) : /https?:\/\/(?:\w+\.)?steampowered\.com\/.*/.test(steamlink);
}
}