项目原始demo,不改动
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.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 

32 rivejä
818 B

  1. 'use strict';
  2. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3. var utils = require('./utils');
  4. var OldValue = function () {
  5. function OldValue(unprefixed, prefixed, string, regexp) {
  6. _classCallCheck(this, OldValue);
  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. OldValue.prototype.check = function check(value) {
  16. if (value.indexOf(this.string) !== -1) {
  17. return !!value.match(this.regexp);
  18. }
  19. return false;
  20. };
  21. return OldValue;
  22. }();
  23. module.exports = OldValue;