old-value.js 707 B

123456789101112131415161718192021222324252627282930
  1. (function() {
  2. var OldValue, utils;
  3. utils = require('./utils');
  4. OldValue = (function() {
  5. function OldValue(_at_unprefixed, _at_prefixed, _at_string, _at_regexp) {
  6. this.unprefixed = _at_unprefixed;
  7. this.prefixed = _at_prefixed;
  8. this.string = _at_string;
  9. this.regexp = _at_regexp;
  10. this.regexp || (this.regexp = utils.regexp(this.prefixed));
  11. this.string || (this.string = this.prefixed);
  12. }
  13. OldValue.prototype.check = function(value) {
  14. if (value.indexOf(this.string) !== -1) {
  15. return !!value.match(this.regexp);
  16. } else {
  17. return false;
  18. }
  19. };
  20. return OldValue;
  21. })();
  22. module.exports = OldValue;
  23. }).call(this);