diff --git a/src/functions.js b/src/functions.js index e950414..48c1446 100644 --- a/src/functions.js +++ b/src/functions.js @@ -40,9 +40,9 @@ exports.getCountryTimeZone = (countryName) => { }; exports.getAllCountryStateNames = () => { - return countryStates.map((country) => { - return country.states.map((states) => { - return country.name - states.name; + return countryStates.flatMap((country) => { + return country.states.map((state) => { + return state + " (" + country.country + ")"; }); }); }; @@ -86,7 +86,11 @@ exports.getFilteredObj = (methodType, filterObj) => { }; exports.getCountryByCode = (number) => { - let countryCode = String(number) - let getCountryCode = countryCode.split('-')[0] - return countryCallingCodes.filter((country) => country.dial_code === getCountryCode)[0] || {} -} \ No newline at end of file + let countryCode = String(number); + let getCountryCode = countryCode.split("-")[0]; + return ( + countryCallingCodes.filter( + (country) => country.dial_code === getCountryCode + )[0] || {} + ); +};