Function toLocalhost

  • Replaces local IP with localhost

    Parameters

    • str: string

      String to replace

    Returns string

    String with replaced IP

    Example

    toLocalhost('https://127.0.0.1:80/test?q#h');
    // returns 'https://localhost:80/test?q#h'