1
0
Fork 0
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:
Behnam Mohammadi 2020-11-09 20:51:33 +03:30 committed by GitHub
parent 996a87b168
commit b0e38bffc3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
}