summaryrefslogtreecommitdiff
path: root/std/fs/empty_dir.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/fs/empty_dir.ts')
-rw-r--r--std/fs/empty_dir.ts14
1 files changed, 3 insertions, 11 deletions
diff --git a/std/fs/empty_dir.ts b/std/fs/empty_dir.ts
index e3d08ef70..0ac5e6420 100644
--- a/std/fs/empty_dir.ts
+++ b/std/fs/empty_dir.ts
@@ -1,14 +1,6 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { join } from "../path/mod.ts";
-const {
- readDir,
- readDirSync,
- mkdir,
- mkdirSync,
- remove,
- removeSync,
- ErrorKind
-} = Deno;
+const { readDir, readDirSync, mkdir, mkdirSync, remove, removeSync } = Deno;
/**
* Ensures that a directory is empty.
* Deletes directory contents if the directory is not empty.
@@ -28,7 +20,7 @@ export async function emptyDir(dir: string): Promise<void> {
}
}
} catch (err) {
- if ((err as Deno.DenoError<Deno.ErrorKind>).kind !== ErrorKind.NotFound) {
+ if (!(err instanceof Deno.Err.NotFound)) {
throw err;
}
@@ -57,7 +49,7 @@ export function emptyDirSync(dir: string): void {
}
}
} catch (err) {
- if ((err as Deno.DenoError<Deno.ErrorKind>).kind !== ErrorKind.NotFound) {
+ if (!(err instanceof Deno.Err.NotFound)) {
throw err;
}
// if not exist. then create it