Skip to content

feat(fjl): add charRange generator - #147

Merged
elycruz merged 1 commit into
mainfrom
89-char-range
Nov 3, 2026
Merged

elycruz merged 1 commit into
mainfrom
89-char-range

Conversation

@elycruz

@elycruz elycruz commented Nov 3, 2026

Copy link
Copy Markdown
Member

Summary

Adds the missing half of #89: charRange, a generator in src/string/charRange.ts, plus a curried $charRange. numRange already landed.

Array.from(charRange('a', 'e'));    // ['a', 'b', 'c', 'd', 'e']
Array.from(charRange('a', 'e', 2)); // ['a', 'c', 'e']
Array.from(charRange('c', 'a'));    // ['c', 'b', 'a']

It's built on numRange, so the range is inclusive and step is normalized the same way. It steps by code point, so characters outside the BMP work. Passing anything other than a single character throws. Without that check, an empty string would make codePointAt return undefined, and numRange would silently use its default range.

Closes #89

Testing

  • New tests/string/test-charRange.ts, and a $charRange entry in the tests/test-currying.ts registry
  • pnpm test: 134 suites and 1478 tests pass
  • npx tsc --noEmit -p packages/fjl/tsconfig.json: clean
  • pnpm build: succeeds, and charRange works from dist/cjs/index.cjs
  • eslint on changed files: clean

🤖 Generated with Claude Code

Reuses numRange, so it has the same inclusive range and step semantics, stepping by code
point. Throws when start or end isn't a single character.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@elycruz
elycruz merged commit 72cf737 into main Nov 3, 2026
3 checks passed
@elycruz
elycruz deleted the 89-char-range branch November 3, 2026 16:15
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.

fjl v2.x - Add numRange, and charRange implementations

1 participant