Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

country-seeker

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

country-seeker - npm Package Compare versions

Comparing version 1.0.4 to 1.0.5

2

package.json
{
"name": "country-seeker",
"version": "1.0.4",
"version": "1.0.5",
"types": "./types/index.d.ts",

@@ -5,0 +5,0 @@ "description": "Get comprehensive country details with ease using country data",

@@ -20,15 +20,47 @@

export const useDialCode = ({ type }: { type: IType }) => {
export const useCountry = ({ type, value }: { type: IType, value: string }) => {
if(!value) {
return countryData;
}
switch(type){
case types.code:
return countryData.find((e) => e.code === type);
return countryData.filter((e) => e.code === value)[0];
case types.dial_code:
return countryData.find((e) => e.dial_code === type);
return countryData.filter((e) => e.dial_code === value)[0];
case types.flag:
return countryData.find((e) => e.flag === type);
return countryData.filter((e) => e.flag === value)[0];
case types.name:
return countryData.find((e) => e.name === type);
return countryData.filter((e) => e.name === value)[0];
default:
return null;
}
};
export const useDialCode = ({ value }: { value: string }) => {
if(!value) {
return countryData;
}
return countryData.filter((e) => e.dial_code === value)[0];
};
export const useFlag = ({ value }: { value: string }) => {
if(!value) {
return countryData;
}
return countryData.filter((e) => e.flag === value)[0];
};
export const useCountryName = ({ value }: { value: string }) => {
if(!value) {
return countryData;
}
return countryData.filter((e) => e.name === value)[0];
};
export const useCountryCode = ({ value }: { value: string }) => {
if(!value) {
return countryData;
}
return countryData.filter((e) => e.code === value)[0];
};
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc