Skip to content
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: #190 存在しないキーを pick すると undefined を値とするキーが結果に含まれるのをやめる #189

Merged
merged 10 commits into from
May 17, 2024

Conversation

mew-ton
Copy link
Contributor

@mew-ton mew-ton commented May 17, 2024

No description provided.

Copy link

changeset-bot bot commented May 17, 2024

🦋 Changeset detected

Latest commit: 3a9c9c8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
json-origami Patch

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

Copy link

coderabbitai bot commented May 17, 2024

Walkthrough

プロジェクト全体の変更は、新しいhas関数の導入やVSCode拡張機能の更新など、機能改善が中心です。テストの追加や修正、コードの最適化も行われました。

Changes

ファイル 変更内容の要約
.vscode/project.code-workspace 推奨拡張機能の更新と追加、不要な推奨リストへの移動
docs/src/content/docs/api/has.md, src/has.ts, src/index.ts has関数の導入とエクスポート
src/lib/modifier.ts ObjectModifierインターフェースにhasメソッドの追加
src/pick.ts 変数名の修正とソースオブジェクト内のキーのみを選択する処理の修正
src/type.ts HasOptionインターフェースとFixedHasOptionタイプの追加
test/has.bench.ts, test/has.spec.ts, test/lib/modifier/has.spec.ts テストとベンチマークの追加
test/omit.spec.ts, test/pick.spec.ts テストの更新と追加

変更の季節がやってきた、
キーを探す新しい道、
テストも増えて、
コードはもっと強く、
うさぎも飛び跳ねる、
新しい機能にワクワク、
コードの森で遊ぼう。

🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@mew-ton mew-ton changed the title Fix/pick and omit unexited source 存在しないキーを pick すると undefined を値とするキーが結果に含まれるのをやめる May 17, 2024
@mew-ton mew-ton changed the title 存在しないキーを pick すると undefined を値とするキーが結果に含まれるのをやめる fix: #190 存在しないキーを pick すると undefined を値とするキーが結果に含まれるのをやめる May 17, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 88745d6 and 0e3e832.
Files ignored due to path filters (1)
  • yarn.lock is excluded by !**/*.lock, !**/*.lock
Files selected for processing (12)
  • .vscode/project.code-workspace (1 hunks)
  • docs/src/content/docs/api/has.md (1 hunks)
  • src/has.ts (1 hunks)
  • src/index.ts (1 hunks)
  • src/lib/modifier.ts (3 hunks)
  • src/pick.ts (2 hunks)
  • src/type.ts (1 hunks)
  • test/has.bench.ts (1 hunks)
  • test/has.spec.ts (1 hunks)
  • test/lib/modifier/has.spec.ts (1 hunks)
  • test/omit.spec.ts (7 hunks)
  • test/pick.spec.ts (8 hunks)
Files skipped from review due to trivial changes (4)
  • .vscode/project.code-workspace
  • src/index.ts
  • test/has.spec.ts
  • test/omit.spec.ts
Additional comments not posted (7)
src/has.ts (1)

26-37: 関数 has の実装とドキュメントは問題なく、適切に機能しているようです。オプションのマージとキーの存在チェックのロジックがクリアに記述されています。

src/pick.ts (1)

Line range hint 47-75: pick 関数の変更点を確認しました。正規表現を使用してキーをフィルタリングし、キーがソースオブジェクトに存在するかどうかを確認してから、それを目的のオブジェクトに設定するロジックが正しく実装されています。

test/has.bench.ts (1)

1-66: ベンチマークテストの実装を確認しました。異なるオブジェクトサイズとキーチェックの割合で has 関数をテストする設定が適切です。

test/pick.spec.ts (1)

Line range hint 1-211: pick 関数のユニットテストを確認しました。配列の扱いや、他のキーの接頭辞または接尾辞であるキーを含むさまざまなシナリオをテストしています。深い等価性チェックのために toStrictEqual を使用することは適切です。

src/type.ts (1)

Line range hint 1-159: 型定義とインターフェースを確認しました。DictionaryHasOption などの定義が含まれており、ライブラリの機能に対する明確なインターフェースを提供しています。HasOption の追加とそのデフォルト設定が正しく実装されています。

test/lib/modifier/has.spec.ts (1)

1-255: ObjectModifier インターフェースの has メソッドのユニットテストを確認しました。ドット表記やブラケット表記のキーを含むさまざまなシナリオでメソッドをテストしています。これらのテストに toBeTruthytoBeFalsy を使用することは適切です。

src/lib/modifier.ts (1)

Line range hint 1-256: ObjectModifier インターフェースとその実装を確認しました。ネストされたオブジェクト構造のキーを取得、設定、チェックするメソッドが含まれています。オプションの処理とキャッシュメカニズムが適切に実装されています。


type: `object`

- #### `arrayIndex`
Copy link

Choose a reason for hiding this comment

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

見出しのフォーマットに誤りがあります。Markdownの見出しは行の始まりから記述する必要があります。

-  - #### `arrayIndex`
+ #### `arrayIndex`
-  - #### `treatUndefinedAsNonexistent`
+ #### `treatUndefinedAsNonexistent`

Also applies to: 45-45


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.

Suggested change
- #### `arrayIndex`
#### `arrayIndex`
#### `treatUndefinedAsNonexistent`

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 0e3e832 and 317ec36.
Files ignored due to path filters (1)
  • biome.json is excluded by !**/*.json
Files selected for processing (1)
  • src/index.ts (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/index.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review Details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits Files that changed from the base of the PR and between 317ec36 and 3a9c9c8.
Files ignored due to path filters (2)
  • biome.json is excluded by !**/*.json
  • package.json is excluded by !**/*.json
Files selected for processing (4)
  • .changeset/rich-rice-crash.md (1 hunks)
  • .vscode/project.code-workspace (1 hunks)
  • docs/src/content/config.ts (1 hunks)
  • test/has.bench.ts (1 hunks)
Files skipped from review due to trivial changes (1)
  • .changeset/rich-rice-crash.md
Files skipped from review as they are similar to previous changes (2)
  • .vscode/project.code-workspace
  • test/has.bench.ts
Additional comments not posted (2)
docs/src/content/config.ts (2)

1-2: インポート文に問題はありません。適切にモジュールがインポートされています。


4-5: collections 定数の設定に問題はありません。docsi18n の両方のコレクションが適切に定義されています。

Copy link

codspeed-hq bot commented May 17, 2024

CodSpeed Performance Report

Merging #189 will degrade performances by 32.14%

Comparing fix/pick-and-omit-unexited-source (3a9c9c8) with main (88745d6)

Summary

❌ 2 regressions
✅ 20 untouched benchmarks

🆕 6 new benchmarks

⚠️ Please fix the performance issues or acknowledge them on CodSpeed.

Benchmarks breakdown

Benchmark main fix/pick-and-omit-unexited-source Change
🆕 has (complex object including 1000 values, check 10% of keys) N/A 93.6 ms N/A
🆕 has (complex object including 1000 values, check 50% of keys) N/A 363 ms N/A
🆕 has (complex object including 1000 values, check 90% of keys) N/A 656.5 ms N/A
🆕 has (complex object including 100 values, check 10% of keys) N/A 2.5 ms N/A
🆕 has (complex object including 100 values, check 50% of keys) N/A 7.5 ms N/A
🆕 has (complex object including 100 values, check 90% of keys) N/A 33.9 ms N/A
pick (complex object including 100 values, pick 10% of keys) 2 ms 3 ms -32.14%
pick (complex object including 100 values, pick 50% of keys) 16.6 ms 18.5 ms -10.32%

@mew-ton mew-ton merged commit 62d5af8 into main May 17, 2024
8 of 9 checks passed
@mew-ton mew-ton deleted the fix/pick-and-omit-unexited-source branch May 17, 2024 06:19
@github-actions github-actions bot mentioned this pull request May 17, 2024
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.

1 participant