Skip to main content

removePathPrefix

Callable

  • removePathPrefix(path: string, prefix: string): string

  • Removes the given prefix from the given path.

    @example
    removePathPrefix('/foo/bar', '/foo'); // '/bar'
    removePathPrefix('/bar', '/foo'); // '/bar'

    Parameters

    • path: string

      The path to remove the prefix from.

    • prefix: string

      The prefix to remove.

    Returns string

    Path with the prefix removed.