提交 | 用户 | age | ||
2a61f6 | 1 | /** |
L | 2 | * Created by PanJiaChen on 16/11/18. |
3 | */ | |
4 | ||
5 | /** | |
6 | * @param {string} path | |
7 | * @returns {Boolean} | |
8 | */ | |
9 | export function isExternal(path) { | |
10 | return /^(https?:|mailto:|tel:)/.test(path) | |
11 | } | |
12 | ||
13 | /** | |
14 | * @param {string} str | |
15 | * @returns {Boolean} | |
16 | */ | |
17 | export function validUsername(str) { | |
18 | const valid_map = ['admin', 'editor'] | |
19 | return valid_map.indexOf(str.trim()) >= 0 | |
20 | } |