Skip to content

Conversation

@anishshobithps
Copy link

  • Adds a custom CaseInsensitiveSet class using a Map for case-insensitive operations.
  • Preserves first-in original casing while ensuring deduplication.
  • Implements add, delete, has, clear, forEach, entries, keys, values, and iteration.
  • Locale-aware normalization via toLocaleLowerCase().
  • Includes comprehensive test suite for common & edge cases.

Replaces Set with CaseInsensitiveSet in init and add.

Closes #515

- Adds a custom `Set`-like class `CaseInsensitiveSet` that performs case-insensitive string operations.
- Internally uses a `Map<string, T>` to store normalized keys and preserve the first-in original casing.
- Implements standard methods: `add`, `delete`, `has`, `clear`, `forEach`, `entries`, `keys`, `values`, and `[Symbol.iterator]`.
- Supports method chaining and uses locale-aware normalization via `toLocaleLowerCase()`.
- Covers construction with default and custom iterables, including case deduplication.
- Verifies core methods: `add`, `delete`, `has`, `clear`, `forEach`, `values`, `keys`, `entries`, and iteration support.
- Ensures case-insensitive logic works across registries, scripts, Unicode, and large strings.
- Adds tests for real-world usage patterns including CLI simulation and integration scenarios.
- Validates original casing preservation and locale-aware behavior.
Copilot AI review requested due to automatic review settings June 9, 2025 17:06
@changeset-bot
Copy link

changeset-bot bot commented Jun 9, 2025

⚠️ No Changeset found

Latest commit: 1435a78

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

This comment was marked as outdated.

@anishshobithps anishshobithps requested a review from Copilot June 9, 2025 17:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Introduces a CaseInsensitiveSet to handle string deduplication in a case-insensitive manner—preserving the casing of the first occurrence—and swaps it in place of native Set in repo init/add commands.

  • Adds a CaseInsensitiveSet implementation with full Set-like API and locale-aware normalization
  • Updates init and add commands to replace Set with CaseInsensitiveSet for repository lists
  • Adds a comprehensive Vitest suite covering functionality, edge cases, performance, and CLI integration

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/case-insensitive-set.test.ts New test suite validating all operations, edge cases, and CLI use
src/utils/case-insensitive-set.ts New CaseInsensitiveSet class using a Map for case-insensitive storage
src/commands/init.ts Replaces native Set with CaseInsensitiveSet in initialization
src/commands/add.ts Replaces native Set with CaseInsensitiveSet in add command
Comments suppressed due to low confidence (1)

src/utils/case-insensitive-set.ts:81

  • [nitpick] The second parameter _value2 in forEach is unused and may confuse readers; consider renaming it to _key or omitting the underscore prefix to better reflect its purpose in a Set callback.
callbackfn: (value: T, _value2: T, set: CaseInsensitiveSet<T>) => void,

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.

bug: Registries are case sensitive

1 participant