"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");

Object.defineProperty(exports, "__esModule", {
  value: !0
}), exports.notAllSpaceValidate = exports.textIsNumValidate = exports.textFirstValueValidate = exports.textValueValidate = exports.objOfStrPropTrim = exports.noSpaceLengthValidate = exports.textLengthValidate = void 0;

var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof")), _amosTool = require("amos-tool"), textLengthValidate = function(t, e) {
  return function(a, o, r) {
    o && ((0, _amosTool.trim)(o).length > t ? r("长度不能大于".concat(t)) : e && (0, _amosTool.trim)(o).length < e ? r("长度不能小于".concat(e)) : r()), 
    r();
  };
};

exports.textLengthValidate = textLengthValidate;

var noSpaceLengthValidate = function(t, e, a) {
  return function(o, r, n) {
    if (r) {
      var i = (0, _amosTool.trim)(r).length;
      e ? (0 === i && n(a), t && i >= t && n("长度范围为".concat(t, "！"))) : t && i >= t && n("长度范围为".concat(t, "！"));
    }
    n();
  };
};

exports.noSpaceLengthValidate = noSpaceLengthValidate;

var objOfStrPropTrim = function(t) {
  "object" === (0, _typeof2.default)(t) && Object.keys(t).forEach((function(e) {
    "string" == typeof t[e] && (t[e] = (0, _amosTool.trim)(t[e]));
  }));
  return t;
};

exports.objOfStrPropTrim = objOfStrPropTrim;

var textValueValidate = function(t, e) {
  return function(a, o, r) {
    o && (/^-?\d+\.?\d*$/.test(o) ? o > t ? r("输入的值不能大于".concat(t)) : e && e < t && o < e ? r("输入的值不能小于".concat(e)) : r() : r("请输入正确的数值格式")), 
    r();
  };
};

exports.textValueValidate = textValueValidate;

var textFirstValueValidate = function(t) {
  return function(e, a, o) {
    a && (/^[1-9]\d*$/.test(a) ? t && (0, _amosTool.trim)(a).length < t && o("长度不能小于".concat(t)) : o("输入的值第一位不能为0")), 
    o();
  };
};

exports.textFirstValueValidate = textFirstValueValidate;

var textIsNumValidate = function(t) {
  return function(e, a, o) {
    a && (/^-?\d+\.?\d*$/.test(a) ? t && a < t ? o("输入的值不能小于".concat(t)) : o() : o("只能输入数字")), 
    o();
  };
};

exports.textIsNumValidate = textIsNumValidate;

var notAllSpaceValidate = function(t) {
  return function(e, a, o) {
    a && 0 === (0, _amosTool.trim)(a).length && o(t), o();
  };
};

exports.notAllSpaceValidate = notAllSpaceValidate;