Skip to content

Commit

Permalink
Rename subclass option
Browse files Browse the repository at this point in the history
  • Loading branch information
slevithan committed Nov 15, 2024
1 parent 2d7ad33 commit e4ce1da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ const regexFromTemplate = (options, template, ...substitutions) => {
expression = handlePlugins(expression, opts);
try {
return opts.subclass ?
new RegExpSubclass(expression, opts.flags, {unmarkEmulationGroups: true}) :
new RegExpSubclass(expression, opts.flags, {useEmulationGroups: true}) :
new RegExp(expression, opts.flags);
} catch (err) {
// Improve DX by always including the generated source in the error message. Some browsers
Expand Down
4 changes: 2 additions & 2 deletions src/subclass.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import {Context, replaceUnescaped} from 'regex-utilities';
@class
@param {string | RegExpSubclass} expression
@param {string} [flags]
@param {{unmarkEmulationGroups: boolean;}} [options]
@param {{useEmulationGroups: boolean;}} [options]
*/
class RegExpSubclass extends RegExp {
#captureMap;
constructor(expression, flags, options) {
let captureMap;
if (options?.unmarkEmulationGroups) {
if (options?.useEmulationGroups) {
({expression, captureMap} = unmarkEmulationGroups(expression));
}
super(expression, flags);
Expand Down

0 comments on commit e4ce1da

Please sign in to comment.