VAMTIGER Is Remote URL will return a boolean when evaluating a defined url string.
VAMTIGER Is Remote URL can be installed using npm or yarn:
npm i --save vamtiger-is-remote-url
or
yarn add vamtiger-is-remote-url
Import or require a referece to VAMTIGER Is Remote URL:
import isRemoteUrl from 'vamtiger-is-remote-url';
or
const isRemoteUrl = require('vamtiger-is-remote-url').default;
VAMTIGER Is Remote URL will return true for a valid remote url:
const isRemoteUrl = require('vamtiger-is-remote-url').default;
const url = 'https://some/https/url';
isRemoteUrl({ url })
// .then(result => handleResult(result)) // result = true
// .catch(handleError)
Otherwise, it will return false:
const isRemoteUrl = require('vamtiger-is-remote-url').default;
const url = 'some/relative/file/path.ext';
isRemoteUrl({ url })
// .then(result => handleResult(result)) // result = false
// .catch(handleError)
Since VAMTIGER Is Remote URL returns a Promise, the result can be more conveniently referenced within an async function:
async someAsyncFunction function() {
const remoteUrl = await isRemoteUrl({ url });
}