old-value.js 606 B

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. var utils = require('./utils');
  3. var OldValue = /*#__PURE__*/function () {
  4. function OldValue(unprefixed, prefixed, string, regexp) {
  5. this.unprefixed = unprefixed;
  6. this.prefixed = prefixed;
  7. this.string = string || prefixed;
  8. this.regexp = regexp || utils.regexp(prefixed);
  9. }
  10. /**
  11. * Check, that value contain old value
  12. */
  13. var _proto = OldValue.prototype;
  14. _proto.check = function check(value) {
  15. if (value.includes(this.string)) {
  16. return !!value.match(this.regexp);
  17. }
  18. return false;
  19. };
  20. return OldValue;
  21. }();
  22. module.exports = OldValue;