You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
404 B
24 lines
404 B
2 years ago
|
/**
|
||
|
* 全局公用方法
|
||
|
* export输出的意思
|
||
|
* import进口的意思
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
/**
|
||
|
* @param {string} path
|
||
|
* @returns {Boolean}
|
||
|
*/
|
||
|
export function isExternal(path) {
|
||
|
return /^(https?:|mailto:|tel:)/.test(path)
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* @param {string} str
|
||
|
* @returns {Boolean}
|
||
|
*/
|
||
|
export function validUsername(str) {
|
||
|
const valid_map = ['admin', 'editor']
|
||
|
return valid_map.indexOf(str.trim()) >= 0
|
||
|
}
|