Skip to content

Commit

Permalink
fix(regexp): properly construct new BSONRegExp when constructor calle…
Browse files Browse the repository at this point in the history
…d without new (#242)
  • Loading branch information
edaniels authored and mbroadst committed Apr 5, 2018
1 parent 78d0c9f commit 93ae799
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/bson/regexp.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function alphabetize(str) {
* @return {BSONRegExp} A MinKey instance
*/
function BSONRegExp(pattern, options) {
if (!(this instanceof BSONRegExp)) return new BSONRegExp();
if (!(this instanceof BSONRegExp)) return new BSONRegExp(pattern, options);

// Execute
this._bsontype = 'BSONRegExp';
Expand Down

0 comments on commit 93ae799

Please sign in to comment.