diff --git a/snippets/isAbsoluteURL.md b/snippets/isAbsoluteURL.md new file mode 100644 index 000000000..8f13f5861 --- /dev/null +++ b/snippets/isAbsoluteURL.md @@ -0,0 +1,15 @@ +### isAbsoluteURL + +Returns `true` if the given string is an absolute URL, `false` otherwise. + +Use a regular expression to test if the string is an absolute URL. + +```js +const isAbsoluteURL = str => /^[a-z][a-z0-9+.-]*:/.test(str); +``` + +```js +isAbsoluteURL('https://google.com'); // true +isAbsoluteURL('ftp://www.myserver.net'); // true +isAbsoluteURL('/foo/bar'); // false +``` diff --git a/tag_database b/tag_database index e2bb75c7e..716ff171b 100644 --- a/tag_database +++ b/tag_database @@ -64,6 +64,7 @@ initializeArrayWithRange:array initializeArrayWithValues:array inRange:math intersection:array +isAbsoluteURL:string isArmstrongNumber:math isArray:utility isBoolean:utility