-
Notifications
You must be signed in to change notification settings - Fork 2
/
deps.ts
25 lines (21 loc) · 925 Bytes
/
deps.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
export * as Types from "https://deno.land/x/[email protected]/types.ts";
export type {
Bot,
Context,
RawApi,
} from "https://deno.land/x/[email protected]/mod.ts";
// export type { Handler as HTMLParserHandler } from "https://deno.land/x/[email protected]/htmlparser2/Parser.ts";
// export { Parser as HTMLParser } from "https://deno.land/x/[email protected]/htmlparser2/Parser.ts";
// a basic debug implementation
import * as c from "https://deno.land/[email protected]/fmt/colors.ts";
const COLORS = [c.red, c.green, c.blue, c.magenta, c.yellow, c.gray];
function colorFn(fn: (s: string) => string) {
return Deno.noColor ? (s: string) => s : fn;
}
export function debug(ns: string) {
ns = colorFn(COLORS[Math.floor(Math.random() * COLORS.length)])(ns);
return function (...data: unknown[]) {
const now = new Date().toLocaleTimeString("en-US", { hour12: false });
console.error(c.cyan(now), ns, ...data);
};
}