-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: #75 twist 関数で文字列の前方一致していたところを、キーの前方一致判定に変更 #76
Conversation
🦋 Changeset detectedLatest commit: c2067b7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Walkthrough変更の概要は、プロジェクト全体の設定とコントロールフローに関するものです。VS Codeのワークスペース設定にTypeScriptのパスが追加され、 Changes
TipsChat with CodeRabbit Bot (
|
], | ||
"settings": { | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ついで
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Files selected for processing (3)
- .vscode/project.code-workspace (1 hunks)
- src/twist.ts (2 hunks)
- test/twist.spec.ts (1 hunks)
Additional comments: 3
.vscode/project.code-workspace (1)
- 1-9: 設定ファイルの変更点は問題ないように見えますが、プロジェクトの他の部分に影響を与えないか確認してください。特に、TypeScriptの設定変更はプロジェクトのビルドや実行に影響を与える可能性があります。
src/twist.ts (1)
- 3-4: 新しいユーティリティ関数
includesKey
のインポート文が正しく追加されました。test/twist.spec.ts (1)
- 251-285: 新しいテストケースが追加され、マップデータのキーが共通のプレフィックスを持つ場合にデータが正しく変換されることを確認しています。この変更は、要約に記載されている内容と一致しています。
const twisted = Object.fromEntries( | ||
Object.entries(folded).map(([key, value]) => { | ||
const found = Object.keys(moveMap).find((k) => key.startsWith(k)) | ||
const found = Object.keys(moveMap).find((k) => includesKey(key, k, option)) | ||
|
||
if (found) { | ||
const newKey = key.replace(found, moveMap[found]!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includesKey
関数の使用方法が間違っています。Object.keys(moveMap).find
を使う代わりに、直接includesKey
を使ってマッチするキーを見つけるべきです。
- const found = Object.keys(moveMap).find((k) => includesKey(key, k, option))
+ const found = includesKey(key, Object.keys(moveMap), option)
Committable suggestion
❗ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
const twisted = Object.fromEntries( | |
Object.entries(folded).map(([key, value]) => { | |
const found = Object.keys(moveMap).find((k) => key.startsWith(k)) | |
const found = Object.keys(moveMap).find((k) => includesKey(key, k, option)) | |
if (found) { | |
const newKey = key.replace(found, moveMap[found]!) | |
const twisted = Object.fromEntries( | |
Object.entries(folded).map(([key, value]) => { | |
const found = includesKey(key, Object.keys(moveMap), option) | |
if (found) { | |
const newKey = key.replace(found, moveMap[found]!) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
間違ってないです。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mew-ton 承知しました。現在の実装を維持することにします。もし他に何か手伝えることがあれば、お知らせください。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- .changeset/khaki-sheep-roll.md (1 hunks)
Additional comments: 1
.changeset/khaki-sheep-roll.md (1)
- 1-5: 変更セットの記述が適切であり、
twist
関数のキーの前方一致判定への変更を正確に反映しています。
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary by CodeRabbit
新機能
バグ修正
機能改善