Skip to main content

ensurePathPrefix

Callable

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

  • Ensures the given path has the given prefix.

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

    Parameters

    • path: string
    • prefix: string

    Returns string

    Path with the prefix added.