1.0.4 • Published 6 months ago

states-us v1.0.4

Weekly downloads
1,309
License
MIT
Repository
github
Last release
6 months ago

NPM Version CI codecov

US States

List of US states and territories.

Installation

npm install states-us --save

Usage

import states from 'states-us';

console.log(states);
// => all states and territories

const example1 = states.filter((x) => x.contiguous);
console.log(example1);
// => contiguous states only

const example2 = states.filter((x) => x.territory);
console.log(example2);
// => territories only

const example3 = states.map((x) => x.abbreviation);
console.log(example2);
// => all state/territory abbreviations

The default export from states-us is an array of object with the following structure:

PropertyTypeDescriptionExample
namestringState name.Alaska
abbreviationstringState abbreviation.AK
territorybooleanIndicates if the state is a territory.false
contiguousbooleanIndicates if the state is contiguous.false

Development

npm install
npm run build