You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-2Lines changed: 4 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -142,7 +142,8 @@ The following functions check whether a given argument satisfies a certain const
142
142
***`ValueIsListOf (Value:any, ValueList:any[]):boolean`**<br>returns `true` if the given `Value` is a "dense" JavaScript array whose elements all equal (at least) one of the items found in the given `ValueList` - or `false` otherwise<br> <br>
143
143
***`ValueIsColor (Value:any):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically valid CSS color specification (checked case-insensitively) - or `false` otherwise
144
144
***`ValueIsEMailAddress (Value:unknown):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically valid EMail address (checked case-insensitively and against the complete string) - or `false` otherwise
145
-
***`ValueIsURL (Value:any):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically valid URL - or `false` otherwise<br> <br>
145
+
***`ValueIsURL (Value:any):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically valid URL (absolute or relative) - or `false` otherwise
146
+
***`ValueIsAbsoluteURL (Value:any, allowedProtocols?:string[]):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically valid *absolute* URL (i.e., one that includes a scheme) - or `false` otherwise. If given, `allowedProtocols` restricts accepted values to URLs using one of the listed protocols (matched case-insensitively, with or without a trailing colon)<br> <br>
146
147
***`ValueIsPhoneNumber (Value:any):boolean`**<br>returns `true` if the given `Value` is a string containing a syntactically plausible phone number in a common national or international notation (digits with the format characters space, `-`, `.`, `/` and parentheses, optionally led by a `+`). With a leading `+`, the digits must follow E.164 rules (7-15 digits, no leading zero), otherwise 3-16 digits are accepted. Please note: this is a plausibility check only - it does not verify that prefixes or number lengths actually exist
147
148
***`ValueIsE164PhoneNumber (Value:any):boolean`**<br>returns `true` if the given `Value` is a string containing a phone number in the canonical [E.164](https://en.wikipedia.org/wiki/E.164) format (a `+` followed by 7-15 digits without leading zero and without any formatting characters, e.g., `+4972112345`) - or `false` otherwise<br> <br>
148
149
***`ValueIsBigInt (Value:unknown):boolean`**<br>returns `true` if the given `Value` is a primitive `BigInt` value - or `false` otherwise
@@ -214,7 +215,8 @@ For the sake of clarity, however, only the first "flavour" (namely `allowXXX`) i
214
215
***`allowListOf (Description:string, Argument:any, ValueList:any[]):any[]|null|undefined`**<br>checks if the given `Argument` (if it exists) is a "dense" JavaScript array whose elements all equal (at least) one of the items found in the given `ValueList` (see `ValueIsListOf`). If this is the case (or `Argument` is missing), the function returns the given `Argument`, otherwise an error is thrown whose message contains the given `Description`<br> <br>
215
216
***`allowColor (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically valid CSS color specification. If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`
216
217
***`allowEMailAddress (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically valid EMail address. If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`
217
-
***`allowURL (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically valid URL. If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`<br> <br>
218
+
***`allowURL (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically valid URL (absolute or relative). If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`
219
+
***`allowAbsoluteURL (Description:string, Argument:any, allowedProtocols?:string[]):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically valid absolute URL (see `ValueIsAbsoluteURL`). If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`<br> <br>
218
220
***`allowPhoneNumber (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a syntactically plausible phone number in a common national or international notation (see `ValueIsPhoneNumber`). If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`
219
221
***`allowE164PhoneNumber (Description:string, Argument:any):string|null|undefined`**<br>checks if the given `Argument` (if it exists) is a string containing a phone number in the canonical E.164 format (see `ValueIsE164PhoneNumber`). If this is the case (or `Argument` is missing), the function returns the primitive value of the given `Argument`, otherwise an error is thrown whose message contains the given `Description`<br> <br>
220
222
***`allowBigInt`**, **`allowSymbol`**, **`allowMap`**, **`allowSet`**, **`allowTypedArray`**, **`allowArrayBuffer`**<br>validate the given `Argument` using `ValueIsBigInt`, `ValueIsSymbol`, `ValueIsMap`, `ValueIsSet`, `ValueIsTypedArray` or `ValueIsArrayBuffer`, resp., and behave like any other `allowXXX` function described above (incl. their `allowedXXX`, `expectXXX` and `expectedXXX` flavours)
0 commit comments