Function validateURI

Validates if a given string is a properly encoded URI.

This function checks if the input string remains unchanged after being decoded and then re-encoded, which indicates that it's a valid URI.

validateURI("https://example.com"); // Returns true
validateURI("https://example.com/path with spaces"); // Returns false
validateURI("https://example.com/path%20with%20spaces"); // Returns true
  • Parameters

    • value: string

      The string to be validated as a URI.

    Returns boolean

    A boolean indicating whether the input is a valid URI (true) or not (false).