npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

usa-state-legislatures

v1.0.4

Published

This package will return various information about a given state legislature- including number of members, term length, and party division.

Downloads

4

Readme

License: ISC Known Vulnerabilities Build Status Coverage Status Maintainability

usa-state-legislatures

This package returns various information about a given USA state legislature- including the name of each chamber, the number of members, the term length by chamber, and whether the state has imposed term limits.

Install

npm install usa-state-legislatures

Usage

Note: All methods in this package require a state to be passed. The state must be passed as a string, and either the full state name or the state abbreviation may be used. Case does not matter, and leading/trailing spaces will be ignored. For instance, all of the following inputs are valid for ther state of Ohio:

  • "Ohio"
  • "ohio"
  • " oHIo "
  • "OH"
  • " oh "

stateLegislatureName(stateName)

This method accepts a valid state as defined above and returns the state's legislature name, the name of it's upper chamber (usually Senate) and the name of it's lower chamber (usually House of Representatives). It is valid for:

  • All 50 states in the United States of America
const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureNames = stateLegislatures.stateLegislatureName('OH') 
console.log(ohioLegislatureNames)
//Would print the following JSON:
{
    "legislatureName": "General Assembly", 
    "lowerHouse": "House of Representatives", 
    "upperHouse": "Senate"
}

stateLegislatureMembers(stateName)

This method accepts a valid state as defined above and returns the state's legislative chambers and their member counts. It is valid for:

  • All 50 states in the United States of America
const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureMembers = stateLegislatures.stateLegislatureMembers('OH') 
console.log(ohioLegislatureMembers)
//Would print the following JSON:
{
    "House of Representatives": 99, 
    "Senate": 33
}

totalStateLegislativeMembers(stateName)

This method accepts a valid state as defined above and returns the state's legislative chambers and their member counts. It is valid for:

  • All 50 states in the United States of America
const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureMembers = stateLegislatures.totalStateLegislatureMembers('OH') 
console.log(ohioLegislatureMembers)
//Would print the following JSON:
{
    "House of Representatives": 99, 
    "Senate": 33,
    "totalStateLegislativeMembers": 132
}

stateLegislatureMembersByChamber(stateName, chamber)

This method accepts a valid state as defined above and a legislative chamber and returns the number of members in that chamber. It is valid for:

  • All 50 states in the United States of America

Valid inputs for the chamber include:

  1. 'upper' for the upper legislative chamber (usually the Senate)
  2. 'lower' for the lower legislative chamber (usually the House)
  3. 'senate' for the upper legislative chamber
  4. 'house' for the lower legislative chamber
  5. The actual name of the legislative chamber in that state. (Ex. 'House of Delegates' in Virginia)
  6. Nebraska has a unicameral legislature. To retrieve results for Nebraska, simply enter 'Legislature' as the chamber.

All inputs are case insensitive and will ignore leading/trailing spaces. The input must be a string.

const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureTermLengths = stateLegislatures.stateLegislatureMembersByChamber('OH','house') //returns 33
const virginiaLegislatureTermLengths = stateLegislatures.stateLegislatureMembersByChamber('Virginia','house of delegates') //returns 100
const nebraskaLegislatureTermLengths = stateLegislatures.stateLegislatureMembersByChamber('Nebraska','Legislature') //returns 49

stateLegislatureTermLength(stateName)

This method accepts a valid state as defined above and returns the state's legislative chambers and their member's term length in years. It is valid for:

  • All 50 states in the United States of America

Important Note: Some states have variable terms for their Senate in order to account for redistricting years. This information is not yet incorporated into this package.

const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureTermLengths = stateLegislatures.stateLegislatureTermLength('OH') 
console.log(ohioLegislatureMembers)
//Would print the following JSON:
{
    "House of Representatives": 2, 
    "Senate": 4
}

stateLegislatureTermLengthByChamber(stateName, chamber)

This method accepts a valid state as defined above and a legislative chamber and returns the member's term length in years for that chamber. It is valid for:

  • All 50 states in the United States of America

Valid inputs for the chamber include:

  1. 'upper' for the upper legislative chamber (usually the Senate)
  2. 'lower' for the lower legislative chamber (usually the House)
  3. 'senate' for the upper legislative chamber
  4. 'house' for the lower legislative chamber
  5. The actual name of the legislative chamber in that state. (Ex. 'House of Delegates' in Virginia)
  6. Nebraska has a unicameral legislature. To retrieve results for Nebraska, simply enter 'Legislature' as the chamber.

All inputs are case insensitive and will ignore leading/trailing spaces. The input must be a string.

Important Note: Some states have variable terms for their Senate in order to account for redistricting. These states return a Senate term length of 2-4-4.

const {stateLegislatures} = require("usa-state-legislatures")

const ohioLegislatureTermLengths = stateLegislatures.stateLegislatureTermLengthByChamber('OH','house') //returns 2
const virginiaLegislatureTermLengths = stateLegislatures.stateLegislatureTermLengthByChamber('Virginia','house of delegates') //returns 2
const nebraskaLegislatureTermLengths = stateLegislatures.stateLegislatureTermLengthByChamber('Nebraska','Legislature') //returns 4

statesWithTermLimits()

This method returns a list of all states in the USA that impose term limits on their state legislatures.

const {termLimits} = require("usa-state-legislatures")

const statesWithTermLimits = termLimits.statesWithTermLimits(); //returns a list of all states with term limits

doesStateHaveTermLimits(stateName)

This method accepts a valid state as defined above and returns whether the state imposes term limits on their state legislature. It is valid for:

  • All 50 states in the United States of America
const {termLimits} = require("usa-state-legislatures")

termLimits.doesStateHaveTermLimits("ohio"); //returns true
termLimits.doesStateHaveTermLimits("NY"); //returns false