@doncicuto/es-provinces
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

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);

Package Sidebar

Install

npm i @doncicuto/es-provinces

Weekly Downloads

19

Version

1.0.1

License

MIT

Unpacked Size

9.28 kB

Total Files

6

Last publish

Collaborators

  • mcabrerizo