summaryrefslogtreecommitdiff
path: root/std/fs
diff options
context:
space:
mode:
authorNayeem Rahman <muhammed.9939@gmail.com>2020-03-10 16:08:58 +0000
committerGitHub <noreply@github.com>2020-03-10 12:08:58 -0400
commit6443e4aed16868c17111a56634aa733211430f46 (patch)
tree8ecbe4d75592fcc78a147b4d69fb61530a0ca2f8 /std/fs
parentfbc4731256a698c07d0d842575d3678d7dc58715 (diff)
refactor: Cleanup options object parameters (#4296)
Diffstat (limited to 'std/fs')
-rw-r--r--std/fs/move.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/std/fs/move.ts b/std/fs/move.ts
index e87d59c6e..48b1ef5f2 100644
--- a/std/fs/move.ts
+++ b/std/fs/move.ts
@@ -10,7 +10,7 @@ interface MoveOptions {
export async function move(
src: string,
dest: string,
- options?: MoveOptions
+ { overwrite = false }: MoveOptions = {}
): Promise<void> {
const srcStat = await Deno.stat(src);
@@ -20,7 +20,7 @@ export async function move(
);
}
- if (options && options.overwrite) {
+ if (overwrite) {
await Deno.remove(dest, { recursive: true });
await Deno.rename(src, dest);
} else {
@@ -37,7 +37,7 @@ export async function move(
export function moveSync(
src: string,
dest: string,
- options?: MoveOptions
+ { overwrite = false }: MoveOptions = {}
): void {
const srcStat = Deno.statSync(src);
@@ -47,7 +47,7 @@ export function moveSync(
);
}
- if (options && options.overwrite) {
+ if (overwrite) {
Deno.removeSync(dest, { recursive: true });
Deno.renameSync(src, dest);
} else {