You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
607 B

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