mirror of
https://github.com/SomboChea/ui
synced 2024-06-02 01:25:05 +07:00
980dac5b2f
* fix: verify validation url and email * chore: disable one expect * fix: lint issue * fix: fix lint
26 lines
622 B
JavaScript
26 lines
622 B
JavaScript
import validator from 'validator';
|
|
|
|
export function isURL(url) {
|
|
return validator.isURL(url || '', {
|
|
protocols: ['http', 'https', 'git+https'],
|
|
require_protocol: true,
|
|
});
|
|
}
|
|
|
|
export function isEmail(email) {
|
|
return validator.isEmail(email || '');
|
|
}
|
|
|
|
export function getRegistryURL() {
|
|
// Don't add slash if it's not a sub directory
|
|
return `${location.origin}${location.pathname === '/' ? '' : location.pathname}`;
|
|
}
|
|
|
|
export function getBaseNamePath() {
|
|
return window.__VERDACCIO_BASENAME_UI_OPTIONS.url_prefix;
|
|
}
|
|
|
|
export function getRootPath() {
|
|
return window.__VERDACCIO_BASENAME_UI_OPTIONS.base;
|
|
}
|