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 validatenull(val) {
    if (val instanceof Array) {
      if (val.length === 0) return true
    } else if (val instanceof Object) {
      if (JSON.stringify(val) === '{}') return true
    } else {
      if (val === 'null' || val == null || val === 'undefined' || val === undefined || val === '') return true
      return false
    }
    return false
  }
  
  export const regular = {
    en_word: {
      pattern: /^\w*$/,
      message: '只能输入英文、数字、下划线'
    }
  }
  