-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"json-origami": patch | ||
--- | ||
|
||
fix: #75 twist 関数で文字列の前方一致していたところを、キーの前方一致判定に変更 |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
{ | ||
"folders": [{ "path": ".." }] | ||
"folders": [ | ||
{ | ||
"path": ".." | ||
} | ||
], | ||
"settings": { | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
@@ -1,6 +1,7 @@ | ||||||||||||||||||||||||||||
import { fold } from './fold' | ||||||||||||||||||||||||||||
import { unfold } from './unfold' | ||||||||||||||||||||||||||||
import type { Dictionary, MoveMap, Twist, TwistOption } from './type' | ||||||||||||||||||||||||||||
import { includesKey } from './utils' | ||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
/** | ||||||||||||||||||||||||||||
* | ||||||||||||||||||||||||||||
|
@@ -16,7 +17,7 @@ export function twist<D extends Dictionary, M extends MoveMap<D>>( | |||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||
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]!) | ||||||||||||||||||||||||||||
Comment on lines
18
to
23
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
- const found = Object.keys(moveMap).find((k) => includesKey(key, k, option))
+ const found = includesKey(key, Object.keys(moveMap), option) Committable suggestion
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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.
ついで