/**
 * 检查字符串长度
 *
 * @export
 * @param {string} str 字符串
 * @param {number} [num = 30] 长度
 * @returns {boolean}
 *
 * @example
 *
 * checkStringLength('123', 2) // true
 * checkStringLength('123', 3) // true
 * checkStringLength('123', 4) // false
 *
 *
 */
function checkStringLength() {
  var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var num = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 30;
  var len = 0;
  var character = "".concat(str);
  for (var i = 0; i < character.length; i++) {
    if (character.charAt(i).match(/[\u4e00-\u9fa5]/g) != null) len += 2;else len += 1;
  }
  return len <= num;
}

export { checkStringLength };
