Skip to content

feat: support optional fromindex in string lastindexof#271

Merged
cs01 merged 1 commit intomainfrom
fix/lastindexof-fromindex
Mar 12, 2026
Merged

feat: support optional fromindex in string lastindexof#271
cs01 merged 1 commit intomainfrom
fix/lastindexof-fromindex

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 12, 2026

Summary

  • str.lastIndexOf("x", 5) now works instead of erroring with "expects 1 argument, got 2"
  • Searches backwards from the given position, matching JS spec behavior
  • Negative fromIndex returns -1 (nothing found before position 0)

Test plan

  • New test fixture string-lastindexof-fromindex.ts covers various fromIndex values
  • npm run verify:quick passes (tests + Stage 1 self-hosting)

🤖 Generated with Claude Code

@cs01 cs01 merged commit 491cd68 into main Mar 12, 2026
12 checks passed
@cs01 cs01 deleted the fix/lastindexof-fromindex branch March 12, 2026 05:35
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