- npm updates
Some checks failed
CI Pipeline / japa-tests (push) Failing after 54s

- renamed 'models' and 'validators' folders
- removed unneccessary files in contracts folder
This commit is contained in:
Kaimbacher 2024-04-30 11:50:50 +02:00
parent a29865b781
commit 08c2edca3b
62 changed files with 371 additions and 458 deletions

View file

@ -0,0 +1,26 @@
export function sum(a: number, b: number): number {
return a + b;
}
export function getDomain(host: string): string {
// $myhost = strtolower(trim($host));
let myHost: string = host.trim().toLocaleLowerCase();
// $count = substr_count($myhost, '.');
const count: number = myHost.split(',').length - 1;
if (count == 2) {
const words = myHost.split('.');
if (words[1].length > 3) {
myHost = myHost.split('.', 2)[1];
}
} else if (count > 2) {
myHost = getDomain(myHost.split('.', 2)[1]);
}
myHost = myHost.replace(new RegExp(/^.*:\/\//i, 'g'), '');
return myHost;
}
export function preg_match(regex: RegExp, str: string) {
const result: boolean = regex.test(str);
return result;
}