refactor: normalize company size

This commit is contained in:
Shivam Mishra
2024-02-29 16:43:10 +05:30
parent 18188ae623
commit 4f43446237
6 changed files with 24 additions and 50 deletions
@@ -4,14 +4,3 @@ export const findMatchingOption = (value, options, defaultValue) => {
);
return match ? match.value || match : defaultValue;
};
export const findCompanySizeMatch = (options, size) => {
if (!size) return undefined;
if (Number.isNaN(size)) return undefined;
return (
options.find(option => {
const upperLimit = option.value.split('-')[1]?.split('+')[0];
return size < (upperLimit ? Number(upperLimit) : Infinity);
})?.value || options[0].value
);
};