-
Notifications
You must be signed in to change notification settings - Fork 98
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
feat!: component set components are now DecodableMaps #1080
Conversation
src/collections/componentSet.ts
Outdated
for (const compKey of this.keys()) { | ||
if (decodeURIComponent(compKey) === decodeURIComponent(key)) { | ||
return compKey; | ||
} | ||
} |
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.
for (const compKey of this.keys()) { | |
if (decodeURIComponent(compKey) === decodeURIComponent(key)) { | |
return compKey; | |
} | |
} | |
return this.keys().find((compKey) => decodeURIComponent(compKey) === decodeURIComponent(key)) |
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.
this.keys()
returns an IterableIterator<string>
so find()
isn't available.
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.
this.keys() returns an IterableIterator so find() isn't available.
you can call Array.from() on those to get a real array.
return Array.from(this.keys()).find((compKey) => decodeURIComponent(compKey) === decodeURIComponent(key))
QA is here: forcedotcom/source-tracking#458 |
Approved for release. |
What does this PR do?
Creates a new DecodeableMap class that extends the standard Map. A DecodableMap is the same as a Map except that the key must be a string, and whenever passing a key it will match on the exact text and the decoded text. Since
ComponentSet.components
Maps use component fullNames as keys, this allows encoded fullNames to match decoded fullNames, and vice versa.What issues does this PR fix or reference?
@W-11658886@