HED JavaScript Library
    Preparing search index...

    Function isSubpath

    • Checks if one path is a subpath of another.

      This function normalizes the input paths before comparison. Normalization includes:

      • Converting null or undefined to an empty string.
      • Replacing a single dot ('.') with an empty string.
      • Removing leading './'.
      • Removing trailing '/'.

      A path is considered a subpath of itself. If the normalized parent path is an empty string (e.g., from '.', './', or '/'), any non-empty child path is considered a subpath.

      Parameters

      • potentialChild: string

        The path to check if it's a subpath.

      • potentialParent: string

        The path to check if it's a parent.

      Returns boolean

      True if potentialChild is a subpath of potentialParent, false otherwise.