@doncicuto/es-provinces
v1.0.1
Published
Array containing the name and INE code of Spanish provinces and the autonomous community which belongs to
Downloads
82
Maintainers
Readme
ES-Provinces
Spanish provinces names and codes as shown in INE (Spain's National Statistics Institute)
Reference: https://www.ine.es/daco/daco42/codmun/cod_ccaa_provincia.htm
Install
yarn add @doncicuto/es-provinces
or
npm install @doncicuto/es-provinces --save
Usage
The default export is an array of objects with the following structure:
| Property | Type | Description | Example |
| ---------- | -------- | ----------------------------- | ----------------- |
| code
| string
| province INE code | 47
|
| name
| string
| province name | Valladolid
|
| commCode
| string
| INE Autonomous community code | 07
|
| commName
| string
| Autonomous Community name | Castilla y León
|
Example (Browser):
import provinces from "@doncicuto/es-provinces";
const names = provinces.map((p) => p.name);
console.log(names);
const filtered = provinces.filter((p) => p.commName === "Castilla y León");
console.log(filtered);
Example (NodeJS):
const provinces = require("@doncicuto/es-provinces").default;
const names = provinces.map((p) => p.name);
console.log(names);
const filtered = provinces.filter((p) => p.commName === "Castilla y León");
console.log(filtered);