mirror of
https://github.com/denoland/std.git
synced 2024-11-21 20:50:22 +00:00
24 lines
633 B
TypeScript
24 lines
633 B
TypeScript
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
// Copyright the Browserify authors. MIT License.
|
|
|
|
import { resolve } from "@std/path/resolve";
|
|
import { toPathString } from "./_to_path_string.ts";
|
|
|
|
/**
|
|
* Checks if two paths are the same.
|
|
*
|
|
* @param src Source file path as a string or URL.
|
|
* @param dest Destination file path as a string or URL.
|
|
*
|
|
* @returns `true` if the paths are the same, `false` otherwise.
|
|
*/
|
|
export function isSamePath(
|
|
src: string | URL,
|
|
dest: string | URL,
|
|
): boolean {
|
|
src = toPathString(src);
|
|
dest = toPathString(dest);
|
|
|
|
return resolve(src) === resolve(dest);
|
|
}
|