Skip to content

Commit

Permalink
Use Set object
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamWr committed Jul 11, 2023
1 parent 5345df7 commit c302f69
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/helpers/cookie-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const getLimitedCookieValue = (value: string): string | number | null =>
return null;
}

const allowedCookieValues = [
const allowedCookieValues = new Set([
'true', 'True',
'false', 'False',
'yes', 'Yes',
Expand All @@ -69,10 +69,10 @@ export const getLimitedCookieValue = (value: string): string | number | null =>
'n', 'N',
'ok', 'OK',
'Accept', 'Reject',
];
]);

let validValue;
if (allowedCookieValues.includes(value)) {
if (allowedCookieValues.has(value)) {
validValue = value;
} else if (/^\d+$/.test(value)) {
validValue = parseFloat(value);
Expand Down

0 comments on commit c302f69

Please sign in to comment.