update deno-commons-mod.ts
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
import {assert} from "jsr:@std/assert/assert";
|
||||
import {assertEquals} from "jsr:@std/assert";
|
||||
import {decodeBase64, encodeBase64} from "jsr:@std/encoding/base64";
|
||||
import {dirname} from "https://deno.land/std@0.208.0/path/mod.ts";
|
||||
import {dirname, fromFileUrl} from "https://deno.land/std/path/mod.ts";
|
||||
|
||||
// reference: https://docs.deno.com/examples/hex_base64_encoding/
|
||||
// import { decodeBase64, encodeBase64 } from "jsr:@std/encoding/base64";
|
||||
@@ -589,6 +589,14 @@ export async function fetchWithTimeout(
|
||||
return response;
|
||||
}
|
||||
|
||||
export function getCurrentScriptFile(): string {
|
||||
return fromFileUrl(import.meta.url);
|
||||
}
|
||||
|
||||
export function getCurrentScriptDirectory(): string {
|
||||
return dirname(getCurrentScriptFile());
|
||||
}
|
||||
|
||||
Deno.test("isOn", () => {
|
||||
assertEquals(false, isOn(undefined));
|
||||
assertEquals(false, isOn(""));
|
||||
|
||||
Reference in New Issue
Block a user