@stryke/path
Version:
A package containing various utilities that expand the functionality of NodeJs's built-in `path` module
26 lines • 1.02 kB
text/typescript
//#region src/is-parent-path.d.ts
/**
* Check if a given path is a parent of another path.
*
* @example
* ```ts
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
* // returns true
* isParentPath("/home/user/project/src/index.ts", "/home/user/project");
* // returns true
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
* // returns false
* isParentPath("/home/user/project/src/index.ts", "/home/user/other");
* // returns false
* isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
* // returns false
* ```
*
* @param childPath - The path to check if it is a child of the parent path.
* @param parentPath - The path to check if it is a parent of the child path.
* @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
*/
declare function isParentPath(childPath: string, parentPath: string): boolean;
//#endregion
export { isParentPath };
//# sourceMappingURL=is-parent-path.d.cts.map