From e4ce1da262af7ae9fb741193a04bf1613eeb44c8 Mon Sep 17 00:00:00 2001 From: Steven Levithan Date: Fri, 15 Nov 2024 14:20:44 +0100 Subject: [PATCH] Rename subclass option --- src/regex.js | 2 +- src/subclass.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/regex.js b/src/regex.js index ecb6e40..7181f0c 100644 --- a/src/regex.js +++ b/src/regex.js @@ -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 diff --git a/src/subclass.js b/src/subclass.js index 4b77155..abf94ac 100644 --- a/src/subclass.js +++ b/src/subclass.js @@ -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);