Ohm-Management - Projektarbeit B-ME
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.

regexp.js 823B

123456789101112131415161718192021222324252627282930313233
  1. /**
  2. * A class representation of the BSON RegExp type.
  3. *
  4. * @class
  5. * @return {BSONRegExp} A MinKey instance
  6. */
  7. function BSONRegExp(pattern, options) {
  8. if (!(this instanceof BSONRegExp)) return new BSONRegExp();
  9. // Execute
  10. this._bsontype = 'BSONRegExp';
  11. this.pattern = pattern || '';
  12. this.options = options || '';
  13. // Validate options
  14. for (var i = 0; i < this.options.length; i++) {
  15. if (
  16. !(
  17. this.options[i] === 'i' ||
  18. this.options[i] === 'm' ||
  19. this.options[i] === 'x' ||
  20. this.options[i] === 'l' ||
  21. this.options[i] === 's' ||
  22. this.options[i] === 'u'
  23. )
  24. ) {
  25. throw new Error('the regular expression options [' + this.options[i] + '] is not supported');
  26. }
  27. }
  28. }
  29. module.exports = BSONRegExp;
  30. module.exports.BSONRegExp = BSONRegExp;