summaryrefslogtreecommitdiff
path: root/std/fs/empty_dir.ts
diff options
context:
space:
mode:
authorBartek IwaƄczuk <biwanczuk@gmail.com>2020-02-21 10:36:13 -0500
committerGitHub <noreply@github.com>2020-02-21 10:36:13 -0500
commitdd8a10948195f231a6a9eb652e3f208813904ad6 (patch)
treef9a4afeb67bbead882c29c2458a5f1f99e2e42db /std/fs/empty_dir.ts
parentd9efb8c02a0036d755c35e8e9c88d58bd45a9e2b (diff)
refactor: remove unneeded ErrorKinds (#3936)
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