@lifaon/path
Version:
Useful tool to manage paths like the URL object
10 lines • 391 B
JavaScript
import { isRootPathSegment } from '../../segment/functions/is/is-root-path-segement.js';
/**
* Converts an absolute path to a relative path: replace the root by `.`.
*/
export function forcePathSegmentsAsRelative(segments, { rootRegExp }) {
if (isRootPathSegment(segments[0], rootRegExp)) {
segments[0] = '.';
}
}
//# sourceMappingURL=force-path-segments-as-relative.js.map