rm_utils.js 518 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. /**
  3. *
  4. *
  5. * @author Mai
  6. * @date
  7. * @version
  8. */
  9. module.exports = {
  10. checkFieldsExist(source, check) {
  11. for (const s of source) {
  12. if (check.indexOf(s) >= 0) {
  13. return true;
  14. }
  15. }
  16. return false;
  17. },
  18. checkFieldsExistReg(source, regStr) {
  19. const reg = new RegExp(regStr, 'igm');
  20. for (const s of source) {
  21. if (reg.test(s)) {
  22. return true;
  23. }
  24. }
  25. return false;
  26. }
  27. };