8000 fix: preserve RegExp match position when cloning by anon5376 · Pull Request #3560 · ramda/ramda · GitHub
[go: up one dir, main page]

Skip to content

fix: preserve RegExp match position when cloning - #3560

Open
anon5376 wants to merge 1 commit into
ramda:masterfrom
anon5376:codex/clone-regexp-last-index
Open

anon5376 wants to merge 1 commit into
ramda:masterfrom
anon5376:codex/clone-regexp-last-index

Conversation

@anon5376
@anon5376 anon5376 commented Oct 9, 2026 •
Copy link
Copy Markdown

Cloning a global or sticky RegExp resets lastIndex, so the clone can match differently from the original.

Copy lastIndex in the deep-clone path. Leave the helper used by R.test unchanged.

Tests: new regression fails before the fix; 1,235 tests and lint pass after. Covers both flags, the next match, and independent cursor state.

I’ve reviewed the code.

Copy lastIndex in the deep-clone path so global and sticky expressions
resume at the source's match position. Leave the shared regex helper and
R.test predicate behavior unchanged.

Assisted-by: OpenAI GPT-6 (Codex) <noreply@openai.com>
Assisted-by: OpenAI GPT-6 Luna <noreply@openai.com>
@github-actions
github-actions Bot commented Oct 9, 2026 •
Copy link
Copy Markdown
Coverage Summary
> ramda@0.32.0 coverage:summary
> BABEL_ENV=cjs nyc --reporter=text-summary mocha -- --reporter=min --require @babel/register

�[2J�[1;3H
1234 passing (937ms)


=============================== Coverage summary ===============================
Statements   : 94.09% ( 2565/2726 )
Branches     : 85.95% ( 1009/1174 )
Functions    : 93.39% ( 565/605 )
Lines        : 94.35% ( 2406/2550 )
================================================================================

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

0