@lifaon/path
Version:
Useful tool to manage paths like the URL object
10 lines (9 loc) • 451 B
TypeScript
import type { IPathSegments } from '../../../../types/segments/path-segments.type.js';
/**
* Returns true if `path` is a sub-path of `parentPath` or equals it (if `equals` is true)
*
* @example:
* `isSubPathOfPathSegments('/a/b/c', '/a/b/c/d')` => `false`
* `isSubPathOfPathSegments('/a/b/c/d', '/a/b/c')` => `true`
*/
export declare function isSubPathOfPathSegments(path: IPathSegments, parentPath: IPathSegments, equals?: boolean): boolean;