Skip to content

feat: support optional position param in string includes() and endswith()#272

Merged
cs01 merged 2 commits intomainfrom
feat/string-includes-position
Mar 12, 2026
Merged

feat: support optional position param in string includes() and endswith()#272
cs01 merged 2 commits intomainfrom
feat/string-includes-position

Conversation

@cs01
Copy link
Copy Markdown
Owner

@cs01 cs01 commented Mar 12, 2026

Summary

  • string.includes(search, position) now accepts optional position parameter per JS spec (was rejecting with error)
  • string.endsWith(search, endPosition) now accepts optional endPosition parameter per JS spec (was rejecting with error)
  • Position is clamped to valid range (negative → 0, past end → string length)

Test plan

  • tests/fixtures/strings/string-includes-position.ts — position=0, mid-string, past end, negative, non-existent
  • tests/fixtures/strings/string-endswith-position.ts — substring match at position, suffix longer than position, clamp past end, negative
  • npm run verify:quick passes (tests + Stage 1 self-hosting)

🤖 Generated with Claude Code

@cs01 cs01 merged commit ac8994c into main Mar 12, 2026
18 of 19 checks passed
@cs01 cs01 deleted the feat/string-includes-position branch March 12, 2026 05:34
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