URL

Verifies if the input data is a valid URL. Internally, it uses node's url module. The result will be the URL object returned from url.parse(input)

Options
  • publicboolean, trueshould we verify the URL is public
  • protocolstring | array(string)if specified, should we verify the URL's protocol is one of the given ones. Default values are http, https
  • hashboolean, falseif specified, should we preserve the hashtag of the URL. By default, we remove it.
'use strict';
thorin.validate('URL', 'inputString', {
   public: true,
   protocol: 'http', // or ['http','https','ftp']
   hash: false
});
Do you have a question or is something missing?

You can always create a new issue on GitHub or contact one of the core founders by chat.