Sorting Things
import countryCodes from './countryCodes.json';
const countryCallingCodeList = () => {
let codes = [];
countryCodes
.filter(country => {
if (country.countryCallingCodes.length === 0) {
return false;
}
return true;
})
.forEach(country => {
const codeLists = country.countryCallingCodes.map(code => {
return {
value: code,
label: `${country.name}(${code})`,
};
});
codes = codes.concat(codeLists);
});
return codes;
};
export default countryCallingCodeList;