URLs.isUrl()

Determine whether the specified string is a valid, fully-qualified URL.

Validates a _fully qualified_ URL- in other words the protocol (e.g. "http") and domain (e.g. "google.com") are both required.

Usage

Hover over inputs/exits for more info.

var URLs = require('machinepack-urls');


// Determine whether the specified string is a valid, fully-qualified URL.

URLs.isUrl({

string: 'http://www.example.com',

}).execSync();

Inputs

string required

The candidate URL to validate.

'http://www.example.com'

Exits

error

An unexpected error occurred.

success

OK.

true