keyv - refactor: remove opts property from Keyv class#1843
Conversation
Replace the public `opts` property with private backing fields and public getters/setters. The constructor now uses a local mergedOptions variable instead of storing configuration on `this.opts`. Added new `emitErrors` getter/setter and `_emitErrors` private field. Updated all internal method references to use private fields directly and updated tests to use public getters instead of `opts`. https://claude.ai/code/session_016DDrEfvCF1pcgvoX4hdkf7
Summary of ChangesHello @jaredwray, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refactors the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request is a nice refactoring that removes the public opts property from the Keyv class, replacing it with private backing fields and public accessors. This is a great improvement for encapsulation and code clarity. The changes are consistently applied, and the tests have been updated to reflect the new API. I have one suggestion to further improve maintainability by centralizing a repeated type cast.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1843 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 32 32
Lines 2432 2432
Branches 447 448 +1
=========================================
Hits 2432 2432 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Introduce a private `_adapter` getter that returns `this._store` cast to `KeyvStoreAdapter`, replacing repeated inline casts throughout the class methods. https://claude.ai/code/session_016DDrEfvCF1pcgvoX4hdkf7
…test Rename private getter from `_adapter` to `_storeAdapter` for clarity. Add test coverage for the new `emitErrors` getter/setter to restore coverage to pre-change levels (99.41% lines). https://claude.ai/code/session_016DDrEfvCF1pcgvoX4hdkf7
Type `_store` directly as `KeyvStoreAdapter` so methods can use it without casts. Only the default value (`new Map() as any`) and the constructor's `Symbol.iterator` check need targeted casts. Removes the `_storeAdapter` getter since it's no longer needed. https://claude.ai/code/session_016DDrEfvCF1pcgvoX4hdkf7
b1b897e to
53c6e80
Compare
Replace the public
optsproperty with private backing fields andpublic getters/setters. The constructor now uses a local mergedOptions
variable instead of storing configuration on
this.opts. Added newemitErrorsgetter/setter and_emitErrorsprivate field. Updatedall internal method references to use private fields directly and
updated tests to use public getters instead of
opts.https://claude.ai/code/session_016DDrEfvCF1pcgvoX4hdkf7