@lifaon/path
Version:
Useful tool to manage paths like the URL object
18 lines • 700 B
JavaScript
import { getProcessPathSegments, } from '../get/get-process-path-segments.js';
import { isAbsolutePathSegments, } from '../is/is-absolute-path-segments.js';
import { resolvePathSegments } from './resolve-path-segments.js';
/**
* Converts a path to an absolute path
*/
export function resolvePathSegmentsWithOptionalRoot(segments, root, options) {
if (root === undefined) {
root = getProcessPathSegments(options);
}
if (isAbsolutePathSegments(root, options)) {
return resolvePathSegments(segments, root, options);
}
else {
throw new Error("Argument 'root' is not a valid root");
}
}
//# sourceMappingURL=resolve-path-segments-with-optional-root.js.map