2024-01-01 21:11:32 +00:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
2023-08-07 07:45:33 +00:00
|
|
|
// This module is browser compatible.
|
|
|
|
|
2023-08-25 09:07:43 +00:00
|
|
|
import { isWindows } from "./_os.ts";
|
2023-08-07 07:45:33 +00:00
|
|
|
import type { ParsedPath } from "./_interface.ts";
|
2023-09-28 10:54:53 +00:00
|
|
|
import { parse as posixParse } from "./posix/parse.ts";
|
|
|
|
import { parse as windowsParse } from "./windows/parse.ts";
|
2023-08-07 07:45:33 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return a `ParsedPath` object of the `path`.
|
|
|
|
* @param path to process
|
|
|
|
*/
|
|
|
|
export function parse(path: string): ParsedPath {
|
|
|
|
return isWindows ? windowsParse(path) : posixParse(path);
|
|
|
|
}
|