2 * A class representation of the BSON RegExp type.
5 * @return {BSONRegExp} A MinKey instance
7 function BSONRegExp(pattern, options) {
8 if(!(this instanceof BSONRegExp)) return new BSONRegExp();
11 this._bsontype = 'BSONRegExp';
12 this.pattern = pattern;
13 this.options = options;
16 for(var i = 0; i < options.length; i++) {
17 if(!(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'
24 throw new Error('the regular expression options [' + this.options[i] + "] is not supported");
29 module.exports = BSONRegExp;
30 module.exports.BSONRegExp = BSONRegExp;