Function relativePath

  • Given a path, replace the CWD with a "." to make it relative.

    Example

    // If CWD is `"/projects"`
    relativePath("/projects/tests/"); // "./tests/"

    Returns

    Relative path.

    Parameters

    • path: string | Readonly<URL>

      Path to make relative.

    Returns string