old-value.js 613 B

1234567891011121314151617181920212223242526272829303132
  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.indexOf(this.string) !== -1) {
  18. return !!value.match(this.regexp);
  19. }
  20. return false;
  21. };
  22. return OldValue;
  23. }();
  24. module.exports = OldValue;