Skip to content

Commit

Permalink
Version 1
Browse files Browse the repository at this point in the history
  • Loading branch information
shadowtime2000 committed Oct 5, 2020
1 parent b52677c commit e389866
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"deno.enable": true,
"deno.import_intellisense_origins": {
"https://deno.land": false
},
}
1 change: 1 addition & 0 deletions dep.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { parse } from "https://deno.land/std/path/mod.ts";
3 changes: 3 additions & 0 deletions mod/dirname.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { parse } from "../dep.ts";

export default (meta: ImportMeta): string => parse(meta.url).dir;
4 changes: 4 additions & 0 deletions mod/filename.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { parse } from "../dep.ts";

export default (meta: ImportMeta): string =>
parse(meta.url).name + parse(meta.url).ext;
18 changes: 18 additions & 0 deletions test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { assert } from "https://deno.land/std/testing/asserts.ts";

import dirname from './mod/dirname.ts';
import filename from './mod/filename.ts';

Deno.test({
name: ".dirname()",
fn(): void {
assert(dirname(import.meta).startsWith("file://"));
},
});

Deno.test({
name: ".filename()",
fn(): void {
assert(filename(import.meta).endsWith(".ts"))
}
})

0 comments on commit e389866

Please sign in to comment.