Skip to content

Commit dd3c232

Browse files
committed
fix(regexp): properly construct new BSONRegExp when constructor called without new
1 parent 78d0c9f commit dd3c232

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/bson/regexp.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function alphabetize(str) {
1414
* @return {BSONRegExp} A MinKey instance
1515
*/
1616
function BSONRegExp(pattern, options) {
17-
if (!(this instanceof BSONRegExp)) return new BSONRegExp();
17+
if (!(this instanceof BSONRegExp)) return new BSONRegExp(pattern, options);
1818

1919
// Execute
2020
this._bsontype = 'BSONRegExp';

0 commit comments

Comments
 (0)