fix(pkg): display if any of multiple attributes exist#7855
Merged
wraithgar merged 1 commit intonpm:latestfrom Oct 18, 2024
Merged
fix(pkg): display if any of multiple attributes exist#7855wraithgar merged 1 commit intonpm:latestfrom
wraithgar merged 1 commit intonpm:latestfrom
Conversation
e085b9e to
3a62bab
Compare
…ut not all exist in package.json
Member
100%, if the user asked for more than one attribute they're always getting an object back. |
Member
|
It may be time to address that breaking change TODO comment. The timing is good cause we're building npm 11 right now. What do you think the logic should be here, then? |
wraithgar
approved these changes
Oct 18, 2024
Member
|
This PR is good, and done, and shouldn't be blocked by discussion of a potential breaking change. We can move forward discussing that still, but this PR is shipping now. Thank you. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See #7854 for the why and more details.
I changed the unwrap logic so that it only runs when the result contains one entry and the amount of arguments is one. Otherwise, when multiple arguments are provided the unwrap results in an undefined. Additionally, I think it makes sense to skip the unwrap logic when the result contains one entry and pkg has multiple arguments because you would expect an object.
In the existing comment above the if-statement, it is mentioned the CLI should not unwrap at all. I chose not to do this because it is not clear to me if this is a final decision and has a large impact. However, if it is the desired direction, I am happy to do the work.
References
Fixes #7854