is.js 490 B

123456789101112131415
  1. "use strict";
  2. const toString = Object.prototype.toString;
  3. function is(val, type) {
  4. return toString.call(val) === `[object ${type}]`;
  5. }
  6. function isString(val) {
  7. return is(val, "String");
  8. }
  9. function isPhone(phone) {
  10. const reg = /^(?:(?:\+|00)86)?1(?:(?:3[\d])|(?:4[5-79])|(?:5[0-35-9])|(?:6[5-7])|(?:7[0-8])|(?:8[\d])|(?:9[189]))\d{8}$/;
  11. return reg.test(phone);
  12. }
  13. exports.isPhone = isPhone;
  14. exports.isString = isString;
  15. //# sourceMappingURL=../../.sourcemap/mp-weixin/utils/is.js.map