How to use valid-url

Comprehensive valid-url code examples:

How to use valid-url.isHttpsUri:

18
19
20
21
22
23
24
25
26
27
try {
  const URL = util.shortentURL(req.query.url);
  if (
    validUrl.isUri(URL) &&
    validUrl.isWebUri(URL) &&
    validUrl.isHttpsUri(URL)
  ) {
    try {
      let domain = URL.replace(/.+\/\/|www.|\..+/g, "");
      if (domain != null || domain != undefined || domain != "") {

How to use valid-url.isWebUri:

123
124
125
126
127
128
129
130
131
132
133
    standaloneReferenceLink('reference/glossary'),
  ];
};


const standaloneLink = (link, label) =>
  isWebUri(link) || link === ''
    ? {
        customProps: standaloneLinkClasses(),
        href: link,
        label,

How to use valid-url.isUri:

26
27
28
29
30
31
32
33
34
35
    name: 'keen:ua_parser',
    input: { ua_string: 'user_agent' },
    output: 'parsed_user_agent',
  });
}
if (config.urlAddon && properties.url && validUrl.isUri(properties.url)) {
  addons.push({
    name: 'keen:url_parser',
    input: { url: 'url' },
    output: 'parsed_page_url',