Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
397b165e55 | |||
c1577c2106 | |||
2b12916246 |
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@ztimson/utils",
|
"name": "@ztimson/utils",
|
||||||
"version": "0.26.10",
|
"version": "0.26.13",
|
||||||
"description": "Utility library",
|
"description": "Utility library",
|
||||||
"author": "Zak Timson",
|
"author": "Zak Timson",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
@ -53,7 +53,7 @@ export function ipV6ToV4(ip: string) {
|
|||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
export function reservedIp(ip: string): boolean {
|
export function reservedIp(ip: string): boolean {
|
||||||
if(ip == 'localhost') return true;
|
if(ip == 'localhost' || ip == '127.0.0.1') return true;
|
||||||
return /\b(10\.(?:[0-9]{1,3}\.){2}[0-9]{1,3})\b|\b(172\.(?:1[6-9]|2[0-9]|3[0-1])\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b|\b(192\.168\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b/.test(ip);
|
return /\b(10\.(?:[0-9]{1,3}\.){2}[0-9]{1,3})\b|\b(172\.(?:1[6-9]|2[0-9]|3[0-1])\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b|\b(192\.168\.(?:[0-9]{1,3}\.)[0-9]{1,3})\b/.test(ip);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,8 +39,8 @@ export function logicTest(target: object, condition: string): boolean {
|
|||||||
case '=':
|
case '=':
|
||||||
case '==': return a == b;
|
case '==': return a == b;
|
||||||
case '!=': return a != b;
|
case '!=': return a != b;
|
||||||
case '+': return typeof a?.includes != 'undefined' ? a.includes(b) : a == b;
|
case '+': return a?.toString().includes(b);
|
||||||
case '-': return typeof a?.includes != 'undefined' ? !a.includes(b) : a != b;
|
case '-': return !a?.toString().includes(b);
|
||||||
case '>': return a > b;
|
case '>': return a > b;
|
||||||
case '>=': return a >= b;
|
case '>=': return a >= b;
|
||||||
case '<': return a < b;
|
case '<': return a < b;
|
||||||
|
Reference in New Issue
Block a user