text: /**
   * 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
  }
  
  export function validEmail(email) {
    const valid_regex = /^[A-Za-zd0-9]+([-_.][A-Za-zd]+)*@([A-Za-zd]+[-.])+[A-Za-zd]{2,5}$/
    return valid_regex.test(email)
  }
  
  export function validPath(path) {
    const path_regex = /^(\/[\-a-zA-Z_0-9\\*]+)+$/
    return path === '/' || path_regex.test(path)
  }
  export function validPathDoNotContainsRoot(path) {
    const path_regex = /^(\/[\-a-zA-Z_0-9\\*]+)+$/
    return path_regex.test(path)
  }
  