Have ideas to improve npm?Join in the discussion! »

    states-us
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.1 • Public • Published

    NPM Version CI Dev Dependency Status 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:

    Property Type Description Example
    name string State name. Alaska
    abbreviation string State abbreviation. AK
    territory boolean Indicates if the state is a territory. false
    contiguous boolean Indicates if the state is contiguous. false

    Development

    npm install
    npm run build
    

    Install

    npm i states-us

    DownloadsWeekly Downloads

    1,922

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    18 kB

    Total Files

    7

    Last publish

    Collaborators

    • avatar