-
Notifications
You must be signed in to change notification settings - Fork 13
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
Duplicate countries to be in lowercase for x-country header update. #1284
Conversation
✅ Test Seed Generated SuccessfullyTo apply the test seed:
Seed Details
|
3b150fb
to
aed9284
Compare
480bd97
to
f622be2
Compare
f622be2
to
90e608e
Compare
90e608e
to
951850d
Compare
951850d
to
5eb4851
Compare
// check if country in uppercase also exists in lowercase | ||
const checkCountriesCase = (countries: string[]) => { | ||
const countrySet = new Set(countries); | ||
for (const country of countries) { |
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.
minor: countries.forEach((country) => {...})
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.
seems like a style preference to me. I prefer the usual for (...) {}
syntax similar to what we have in C++ codebase in Chromium.
|
||
function duplicateCountriesAsLowercase(variationsSeed: VariationsSeed) { | ||
// For now duplicate the country filters to lowercase. | ||
const duplicate = (countries: string[]) => { |
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.
What about Array.from(new Set([...countries, ...countries.map((c) => c.toLowerCase())]))
?
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 will change the order of countries
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.
LGTM with a few nits.
List countries both in upper and lowercase so we can safely update server to use lowercase value in x-country header.
Related devops issue https://github.com/brave/devops/issues/12890