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.3 to 1.0.4

types/__test__/index.test.d.ts

15

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

@@ -8,7 +8,13 @@ "description": "Get comprehensive country details with ease using country data",

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "jest",
"build": "tsc",
"start": "node dist/index.js",
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts"
"dev": "nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/index.ts",
"clean": "rm -rf node_modules && rm -rf dist"
},
"jest": {
"transform": {
"^.+\\.tsx?$": "ts-jest"
}
},
"repository": {

@@ -29,3 +35,6 @@ "type": "git",

"devDependencies": {
"@types/jest": "^29.5.1",
"jest": "^29.5.0",
"nodemon": "^2.0.22",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",

@@ -32,0 +41,0 @@ "typescript": "^5.0.4"

25

src/index.ts

@@ -20,14 +20,15 @@

export const getDialCode = (type: IType) => {
export const useDialCode = ({ type }: { type: IType }) => {
switch(type){
case types.code:
return countryData.filter((e) => e.code === type)[0];
case types.dial_code:
return countryData.filter((e) => e.code === type)[0];
case types.flag:
return countryData.filter((e) => e.code === type)[0];
case types.name:
return countryData.filter((e) => e.code === type)[0];
}
}
case types.code:
return countryData.find((e) => e.code === type);
case types.dial_code:
return countryData.find((e) => e.dial_code === type);
case types.flag:
return countryData.find((e) => e.flag === type);
case types.name:
return countryData.find((e) => e.name === type);
default:
return null;
}
};
import { ICountryData, IType } from "./utils/types";
export declare const getCountries: () => ICountryData[];
export declare const getDialCode: (type: IType) => ICountryData | undefined;
export declare const useDialCode: ({ type }: {
type: IType;
}) => ICountryData | null | undefined;
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