isURL()function
isURL(value: unknown): value is ImmutableURL
| Param | Type | |
|---|---|---|
value | unknown | Unknown value to test. required |
| Return | |
|---|---|
value is ImmutableURL | true if value is a true scheme://host URL object, otherwise false. |
Is an unknown value a URL object?
- Must be a
URLinstance and its origin must start withscheme://
Examples
if (isURL(value)) value.pathname; // `value` is narrowed to `ImmutableURL`