country-seeker
Advanced tools
Comparing version 1.0.3 to 1.0.4
{ | ||
"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" |
@@ -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; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
22005
13
78
0
6