resolvePathUnder
Callable
Parameters
path: string
The absolute or relative path to resolve.
parentPath: string
The path the result must stay under.
Returns string
The normalized resolved path, or undefined when it is not a child.
The absolute or relative path to resolve.
The path the result must stay under.
The normalized resolved path, or undefined when it is not a child.
Resolves a path and returns it only when it stays under a parent path.
Absolute paths are checked as-is. Relative paths are resolved from the parent path. The parent itself is not considered to be under the parent. Paths containing null bytes are rejected before resolution.