feat: update deno-commons-mod.ts

This commit is contained in:
2025-01-19 12:55:32 +08:00
parent 2cdf84b1d1
commit de2b03a047

View File

@@ -107,6 +107,18 @@ export function formatPercent(a: number, b: number): string {
return p.substring(0, pointIndex) + "." + decimalPart + "%"; return p.substring(0, pointIndex) + "." + decimalPart + "%";
} }
export async function clearLastLine() {
await printLastLine("");
}
export async function printLastLine(line: string) {
await Deno.stdout.write(
new TextEncoder().encode(
`\x1b[1000D${line}\x1b[K`,
),
);
}
Deno.test("isOn", () => { Deno.test("isOn", () => {
assertEquals(false, isOn(undefined)); assertEquals(false, isOn(undefined));
assertEquals(false, isOn("")); assertEquals(false, isOn(""));