New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

election-utils

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

election-utils

This module provides various utility functions for dealing with AP election data.

  • 1.0.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
decreased by-90.7%
Maintainers
1
Weekly downloads
 
Created
Source

election-utils

This module provides various utility functions for dealing with AP election data.

Install

  • npm install --save election-utils

API Reference

Note: currently the API is rather verbose and somewhat unintuitive. This will probably change in the future.

Standardize
import { Standardize } from 'election-utils';

# Standardize.expand.state(stateAbbreviation)

Expands a state abbreviation to its title-case name. stateAbbreviation is case-insensitive.

Standardize.expand.state('nh');
// => New Hampshire

# Standardize.collapse.state(stateName)

Collapse a state name to its upper-case abbreviation. stateName is case-insensitive.

Standardize.collapse.state('new hampshire');
// => NH

# Standardize.expand.party(partyAbbreviation)

Expands a party abbreviation to its title-case name. partyAbbreviation is case-insensitive.

Standardize.expand.party('dem');
// => Democratic

# Standardize.collapse.party(partyName)

Collapse a party name to its upper-case abbreviation. partyName is case-insensitive.

Standardize.collapse.party('democratic');
// => DEM

# Standardize.raceType(raceType, invert)

Convert race type to its appropriate name. Set invert to true to convert back to what AP gives us.

Standardize.raceType('Caucus');
// => Caucuses

Standardize.raceType('Primary');
// => Primary

Standardize.raceType('Caucuses', true);
// => Caucus

Keywords

FAQs

Package last updated on 08 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc