This commit is contained in:
xiaozhiyong
2023-02-14 14:34:23 +08:00
commit b8b3905598
83 changed files with 4465 additions and 0 deletions

20
src/utils/validate.js Normal file
View File

@@ -0,0 +1,20 @@
/**
* Created by PanJiaChen on 16/11/18.
*/
/**
* @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
}