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

chore: use Map, not Record, for listing all roles #512

Merged
merged 2 commits into from
Mar 11, 2024
Merged

Conversation

EvanHahn
Copy link
Contributor

@EvanHahn EvanHahn commented Mar 9, 2024

This change should have no user impact, and is not urgent.

I generally prefer Maps to Records when the keys are variable. This is mainly due to bugs with keys like hasOwnProperty or __proto__, but they also allow non-string keys.

As far as I could tell, we were always using Maps in relevant spots except for Roles.prototype.getAll()...but no longer!

This change should have no user impact.

I generally prefer `Map`s to `Record`s when the keys are variable. This
is mainly due to bugs with keys like `hasOwnProperty` or `__proto__`,
but they also allow non-string keys.

As far as I could tell, we were always using `Map`s in relevant spots
except for `Roles.prototype.getAll()`...but no longer!
@EvanHahn EvanHahn requested review from gmaclennan and achou11 March 9, 2024 05:10
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

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

Looks good. Suggestion can be ignored.

src/mapeo-project.js Outdated Show resolved Hide resolved
Copy link
Member

@gmaclennan gmaclennan left a comment

Choose a reason for hiding this comment

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

Looks good. Suggestion can be ignored.

@EvanHahn EvanHahn merged commit af55912 into main Mar 11, 2024
4 checks passed
@EvanHahn EvanHahn deleted the role-getall-map branch March 11, 2024 18:15
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.

2 participants