Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as _URLParser from 'url-parse';
const URLParser = typeof _URLParser === 'function' ? _URLParser : _URLParser.default;
export const LCHTypeURLCallback = function(inputData) {
if (typeof inputData !== 'string') {
// throw new Error('LCHErrorInputInvalid');
return false
}
if (!(new URLParser(inputData)).hostname) {
return false;
}
return true;
};
export const LCHTypeStringCanonicalExampleCallback = function() {
return 'http://example.com';
import * as _URLParser from 'url-parse';
const URLParser = typeof _URLParser === 'function' ? _URLParser : _URLParser.default;
export const LCHPrimitiveURLCallback = function(inputData) {
if (typeof inputData !== 'string') {
// throw new Error('LCHErrorInputInvalid');
return false;
}
if (!(new URLParser(inputData, {})).hostname) { // To parse an input independently of the browser's current URL (e.g. for functionality parity with the library in a Node environment), pass an empty location object as the second parameter
return false;
}
return true;
};
export const LCHPrimitiveStringCanonicalExampleCallback = function() {
return 'http://example.com';