apps-script-utils 2.1.1 Help

nonUrl

function nonUrl<T>(value: T | string): value is T;

nonUrl(value) is the same test as !isUrl(value), written so that a guard clause reads as a sentence rather than as a negation.

An http, https or ftp URL with something after the scheme and no whitespace anywhere. A bare host such as "example.com" is not one.

isX and nonX answer a question and never interrupt control flow; requireX and requireNonX hand the value back or throw. The scheme is explained in Validation conventions.

Parameters

Parameter

Type

Description

value

T \| string

The value to check.

Returns

boolean — true when the value is not a URL; otherwise false.

In TypeScript the guard narrows value to T inside the branch.

Examples

What passes and what does not

nonUrl("example.com"); // => true nonUrl("https://"); // => true nonUrl("https://exa mple.com"); // => true nonUrl("https://example.com"); // => false nonUrl("http://example.com/a?b=1"); // => false

See also

Source

src/net/url/nonUrl.ts

23 September 2026

This documentation was generated with AI (Claude) from the library's source code.