Skip to content

Commit

Permalink
Revert name change
Browse files Browse the repository at this point in the history
  • Loading branch information
slevithan committed Jan 29, 2025
1 parent 80903ca commit 4615a94
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
16 changes: 8 additions & 8 deletions src/atomic.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Apply transformations for atomic groups: `(?>…)`.
function atomic(expression, data) {
const hiddenCaptures = data?.hiddenCaptures ?? [];
// Capture transfer is used by <github.com/slevithan/oniguruma-to-es>
let captureTransfersMap = data?.captureTransfersMap ?? new Map();
let captureTransfers = data?.captureTransfers ?? new Map();
if (!/\(\?>/.test(expression)) {
return {
pattern: expression,
captureTransfersMap,
captureTransfers,
hiddenCaptures,
};
}
Expand Down Expand Up @@ -68,16 +68,16 @@ function atomic(expression, data) {
hasProcessedAG = true;
addedHiddenCaptures.push(addedCaptureNum);
incrementIfAtLeast(hiddenCaptures, addedCaptureNum);
if (captureTransfersMap.size) {
const newCaptureTransfersMap = new Map();
captureTransfersMap.forEach((/** @type {number} */ from, /** @type {number | string} */ to) => {
newCaptureTransfersMap.set(
if (captureTransfers.size) {
const newCaptureTransfers = new Map();
captureTransfers.forEach((/** @type {number} */ from, /** @type {number | string} */ to) => {
newCaptureTransfers.set(
// `to` can be a group number or name
to >= addedCaptureNum ? to + 1 : to,
from + (from >= addedCaptureNum ? 1 : 0)
);
});
captureTransfersMap = newCaptureTransfersMap;
captureTransfers = newCaptureTransfers;
}
break;
}
Expand Down Expand Up @@ -113,7 +113,7 @@ function atomic(expression, data) {

return {
pattern: expression,
captureTransfersMap,
captureTransfers,
hiddenCaptures,
};
}
Expand Down
4 changes: 2 additions & 2 deletions src/regex.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ import {Context, hasUnescaped, replaceUnescaped} from 'regex-utilities';
@typedef {string | RegExp | Pattern | number} InterpolatedValue
@typedef {{
flags?: string;
captureTransfersMap?: Map<number | string, number>;
captureTransfers?: Map<number | string, number>;
hiddenCaptures?: Array<number>;
}} PluginData
@typedef {{
pattern: string;
captureTransfersMap?: Map<number | string, number>;
captureTransfers?: Map<number | string, number>;
hiddenCaptures?: Array<number>;
}} PluginResult
@typedef {TemplateStringsArray | {raw: Array<string>}} RawTemplate
Expand Down

0 comments on commit 4615a94

Please sign in to comment.