mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
refactor(std): remove redundant code in move.ts (#8269)
This commit is contained in:
parent
996a87b168
commit
b0e38bffc3
1 changed files with 4 additions and 4 deletions
|
@ -24,14 +24,14 @@ export async function move(
|
|||
if (await exists(dest)) {
|
||||
await Deno.remove(dest, { recursive: true });
|
||||
}
|
||||
await Deno.rename(src, dest);
|
||||
} else {
|
||||
if (await exists(dest)) {
|
||||
throw new Error("dest already exists.");
|
||||
}
|
||||
await Deno.rename(src, dest);
|
||||
}
|
||||
|
||||
await Deno.rename(src, dest);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -53,11 +53,11 @@ export function moveSync(
|
|||
if (existsSync(dest)) {
|
||||
Deno.removeSync(dest, { recursive: true });
|
||||
}
|
||||
Deno.renameSync(src, dest);
|
||||
} else {
|
||||
if (existsSync(dest)) {
|
||||
throw new Error("dest already exists.");
|
||||
}
|
||||
Deno.renameSync(src, dest);
|
||||
}
|
||||
|
||||
Deno.renameSync(src, dest);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue