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

use-country-info

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

use-country-info - npm Package Compare versions

Comparing version 1.0.15 to 1.0.16

112

package.json
{
"name": "use-country-info",
"description": "use-country-info",
"version": "1.0.15",
"version": "1.0.16",
"license": "MIT",

@@ -27,5 +27,4 @@ "author": "Erik Ferreira de Lima <erik.lima.f@outlook.com>",

"test": "jest",
"coverage": "jest --coverage",
"deploy": "npm version patch && npm publish",
"deps": "npm install --legacy-peer-deps"
"coverage": "node test.js --watchAll=false --coverage --watchAll=false",
"deploy": "npm version patch && npm publish"
},

@@ -45,16 +44,37 @@ "repository": {

"peerDependencies": {
"react": ">=16.0.2"
"react": ">=18.2.0"
},
"jest": {
"roots": [
"<rootDir>/src"
],
"collectCoverageFrom": [
"src/**/*.{js,jsx,ts,tsx}",
"!src/index.tsx",
"!src/reportWebVitals.{js,ts}",
"!src/**/*.d.{js,ts}",
"!src/mock/data.mock.ts"
],
"preset": "ts-jest",
"testEnvironment": "node",
"transform": {
"^.+\\.jsx?$": "babel-jest",
"^.+\\.tsx?$": "ts-jest"
},
"testMatch": [
"<rootDir>/src/**/__tests__/**/*.{js,jsx,ts,tsx}",
"<rootDir>/src/**/*.{spec,test}.{js,jsx,ts,tsx}"
]
},
"devDependencies": {
"@airbnb/config-eslint": "^3.1.0",
"@babel/cli": "^7.22.6",
"@babel/core": "^7.22.8",
"@babel/plugin-external-helpers": "^7.22.5",
"@babel/cli": "^7.23.4",
"@babel/core": "^7.23.6",
"@babel/plugin-external-helpers": "^7.23.3",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.22.7",
"@babel/plugin-proposal-do-expressions": "^7.22.5",
"@babel/plugin-proposal-export-default-from": "^7.22.5",
"@babel/plugin-proposal-decorators": "^7.23.6",
"@babel/plugin-proposal-do-expressions": "^7.23.3",
"@babel/plugin-proposal-export-default-from": "^7.23.3",
"@babel/plugin-proposal-export-namespace-from": "^7.18.9",
"@babel/plugin-proposal-function-bind": "^7.22.5",
"@babel/plugin-proposal-function-sent": "^7.22.5",
"@babel/plugin-proposal-function-bind": "^7.23.3",
"@babel/plugin-proposal-function-sent": "^7.23.3",
"@babel/plugin-proposal-json-strings": "^7.18.6",

@@ -65,36 +85,36 @@ "@babel/plugin-proposal-logical-assignment-operators": "^7.20.7",

"@babel/plugin-proposal-optional-chaining": "^7.21.0",
"@babel/plugin-proposal-pipeline-operator": "^7.22.5",
"@babel/plugin-proposal-throw-expressions": "^7.22.5",
"@babel/plugin-proposal-pipeline-operator": "^7.23.3",
"@babel/plugin-proposal-throw-expressions": "^7.23.3",
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
"@babel/plugin-syntax-import-meta": "^7.10.4",
"@babel/preset-env": "^7.22.9",
"@babel/preset-react": "^7.22.5",
"@babel/preset-typescript": "^7.22.5",
"@parcel/babel-preset-env": "^2.9.3",
"@parcel/core": "^2.9.3",
"@parcel/packager-ts": "^2.9.3",
"@parcel/transformer-typescript-types": "^2.9.3",
"@parcel/types": "^2.9.3",
"@testing-library/react": "^14.0.0",
"@testing-library/react-hooks": "^8.0.1",
"@types/jest": "^29.5.3",
"@types/react": "^17.0.62",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"babel-jest": "^29.6.1",
"@babel/preset-env": "^7.23.6",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@parcel/babel-preset-env": "^2.10.3",
"@parcel/core": "^2.10.3",
"@parcel/packager-ts": "^2.10.3",
"@parcel/transformer-typescript-types": "^2.10.3",
"@parcel/types": "^2.10.3",
"@testing-library/jest-dom": "^6.1.5",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.11",
"@types/lodash": "^4.14.202",
"@types/react": "^18.2.45",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"axios": "^1.6.2",
"babel-jest": "^29.7.0",
"babel-loader": "^9.1.3",
"css-loader": "^6.8.1",
"eslint": "^8.44.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-config-node": "^4.1.0",
"eslint-config-prettier": "^8.8.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-import-helpers": "^1.3.1",
"eslint-plugin-prettier": "^5.0.0",
"eslint-plugin-react": "^7.32.2",
"eslint": "^8.55.0",
"eslint-plugin-prettier": "^5.0.1",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-sonarjs": "^0.19.0",
"jest": "^29.6.1",
"nodemon": "^3.0.1",
"parcel": "^2.9.3",
"prettier": "^3.0.0",
"eslint-plugin-sonarjs": "^0.23.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jsdom": "^23.0.1",
"node-notifier": "^10.0.1",
"nodemon": "^3.0.2",
"parcel": "^2.10.3",
"prettier": "^3.1.1",
"react": "^18.2.0",

@@ -105,7 +125,7 @@ "react-dom": "^18.2.0",

"ts-jest": "^29.1.1",
"ts-loader": "^9.4.4",
"ts-node": "^10.9.1",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"ts-node-dev": "^2.0.0",
"typescript": "^5.1.6"
"typescript": "^5.3.3"
}
}

@@ -7,5 +7,4 @@ # use-country-info

<details>
<br/>
<summary> English-USA </summary>
### English-USA
<br/>

@@ -239,233 +238,1 @@

</br>
</details>
## Como usar - Português-BR
O hook useCountryInfo é um hook React que permite obter informações detalhadas sobre países de forma fácil e eficiente. Com este hook, você pode acessar dados abrangentes, como informações demográficas, geográficas e culturais de qualquer país diretamente no seu aplicativo React.
## Instalação
Para utilizar o hook useCountryInfo, você precisa ter o React instalado em seu projeto. Execute o seguinte comando para instalar o hook:
```shell
npm install use-country-info
```
ou
```shell
yarn add use-country-info
```
## Uso
Aqui está um exemplo básico de como utilizar o hook useCountryInfo em um componente React:
```js
import React from 'react';
import { useCountryInfo } from 'use-country-info';
function PageExample() {
const {
allCountryInfo,
ddiInfo,
countryflags
} = useCountryInfo();
// Render the country data or use it as needed
return (
<div>
{allCountryInfo.map((item): any => (
<p key={item.name?.common}>{item.capital}</p>
))}
</div>
);
}
export default PageExample;
```
## Objetos de exemplo
<details>
<br/>
<summary> AllCountryInfo </summary>
<br/>
```js
{
"name": {
"common": "Jordan",
"official": "Hashemite Kingdom of Jordan",
"nativeName": {
"ara": {
"official": "المملكة الأردنية الهاشمية",
"common": "الأردن"
}
}
},
"tld": [
".jo",
"الاردن."
],
"cca2": "JO",
"ccn3": "400",
"cca3": "JOR",
"cioc": "JOR",
"independent": true,
"status": "officially-assigned",
"unMember": true,
"currencies": {
"JOD": {
"name": "Jordanian dinar",
"symbol": "د.ا"
}
},
"countryCallingCode": {
"root": "+9",
"suffixes": [
"62"
]
},
"capital": [
"Amman"
],
"altSpellings": [
"JO",
"Hashemite Kingdom of Jordan",
"al-Mamlakah al-Urdunīyah al-Hāshimīyah"
],
"region": "Asia",
"subregion": "Western Asia",
"languages": {
"ara": "Arabic"
},
"latlng": [
31,
36
],
"landlocked": false,
"borders": [
"IRQ",
"ISR",
"PSE",
"SAU",
"SYR"
],
"area": 89342,
"demonyms": {
"eng": {
"f": "Jordanian",
"m": "Jordanian"
},
"fra": {
"f": "Jordanienne",
"m": "Jordanien"
}
},
"flag": "🇯🇴",
"maps": {
"googleMaps": "https://goo.gl/maps/ko1dzSDKg8Gsi9A98",
"openStreetMaps": "https://www.openstreetmap.org/relation/184818"
},
"population": 10203140,
"gini": {
"2010": 33.7
},
"fifa": "JOR",
"car": {
"signs": [
"HKJ"
],
"side": "right"
},
"timezones": [
"UTC+03:00"
],
"continents": [
"Asia"
],
"flags": {
"png": "https://flagcdn.com/w320/jo.png",
"svg": "https://flagcdn.com/jo.svg",
"alt": "The flag of Jordan is composed of three equal horizontal bands of black, white and green, with a red isosceles triangle superimposed on the hoist side of the field. This triangle has its base on the hoist end, spans about half the width of the field and bears a small seven-pointed white star at its center."
},
"coatOfArms": {
"png": "https://mainfacts.com/media/images/coats_of_arms/jo.png",
"svg": "https://mainfacts.com/media/images/coats_of_arms/jo.svg"
},
"startOfWeek": "sunday",
"capitalInfo": {
"latlng": [
31.95,
35.93
]
},
"postalCode": {
"format": "#####",
"regex": "^(\\d{5})$"
}
},
```
</details>
<details>
<br/>
<summary> ddiInfo </summary>
<br/>
```js
{
"countryCallingCode": {
"root": "+9",
"suffixes": [
"62"
]
},
"flag": "🇲🇵",
"flags": {
"png": "https://flagcdn.com/w320/jo.png",
"svg": "https://flagcdn.com/jo.svg",
"alt": "The flag of Jordan is composed of three equal horizontal bands of black, white and green, with a red isosceles triangle superimposed on the hoist side of the field. This triangle has its base on the hoist end, spans about half the width of the field and bears a small seven-pointed white star at its center."
},
}
```
</details>
<details>
<br/>
<summary> countryflags </summary>
<br/>
```js
{
"name": {
"common": "Jordan",
"official": "Hashemite Kingdom of Jordan",
},
"flag": "🇲🇵",
"flags": {
"png": "https://flagcdn.com/w320/jo.png",
"svg": "https://flagcdn.com/jo.svg",
"alt": "The flag of Jordan is composed of three equal horizontal bands of black, white and green, with a red isosceles triangle superimposed on the hoist side of the field. This triangle has its base on the hoist end, spans about half the width of the field and bears a small seven-pointed white star at its center."
},
}
```
</details>
##
No exemplo acima, importamos o hook useCountryInfo e o utilizamos no componente CountryInfo. O hook retorna duas variáveis: allInfo e callingCountries, que contêm as informações de todos os países e as informações específicas para os códigos de chamada de cada país, respectivamente.
Você pode utilizar essas variáveis para renderizar as informações dos países no seu componente ou utilizá-las conforme necessário.
## Contribuição
Este é um projeto de código aberto, e encorajamos contribuições da comunidade. Se você encontrar problemas, bugs ou tiver ideias para melhorias, fique à vontade para abrir uma issue ou enviar um pull request no repositório oficial do projeto no GitHub.
## Licença
Este projeto está licenciado sob a Licença MIT. Consulte o arquivo LICENSE para obter mais informações.
```js
Este é apenas um exemplo mais elaborado de README.md para o hook `useCountryInfo`. Certifique-se de personalizar e atualizar o conteúdo do arquivo conforme necessário, adicionando seções adicionais relevantes, como exemplos de uso mais avançados, configuração e requisitos de ambiente.
```

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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