-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.ts
45 lines (37 loc) · 963 Bytes
/
utils.ts
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
import { exec } from "https://deno.land/x/execute@v1.1.0/mod.ts";
import { rgb24 } from "https://deno.land/std@0.173.0/fmt/colors.ts";
// colors
export const colorCodeToHex = (code: string) => {
return Number("0x" + code.slice(1));
};
export const yellow = (msg: string) => rgb24(msg, colorCodeToHex("#fabd2f"));
// exit wrapper
export const exit = () => Deno.exit(0);
export const hasSpace = (input: string) => {
if (input.includes(" ") || input.includes(" ")) {
return true;
} else {
return false;
}
};
// check if the string is empty
export function isEmptyString(str: string) {
if (str.length <= 0) {
return true;
} else {
return false;
}
}
export async function execDeno(
path: string,
) {
console.log(yellow("Script start✨"));
console.log(
rgb24(
`Run script ==> ${path}`,
colorCodeToHex("#b8bb26"),
),
);
await import(path);
console.log(yellow("Script done...Happy Hacking✨"));
}