Skip to content

Instantly share code, notes, and snippets.

View Abelhawk's full-sized avatar

Austin Ballard Abelhawk

  • Utah
View GitHub Profile
@Abelhawk
Abelhawk / state-abbreviation.pipe.ts
Created October 23, 2019 21:40
A custom Angular pipe for abbreviating US state names
import { Pipe, PipeTransform } from '@angular/core';
@Pipe({ name: 'stateAbbreviation' })
export class StateAbbreviationPipe implements PipeTransform {
states = [
{ state: 'Alabama', abbr: 'AL' },
{ state: 'Alaska', abbr: 'AK' },
{ state: 'Arizona', abbr: 'AZ' },
{ state: 'Arkansas', abbr: 'AR' },
{ state: 'California', abbr: 'CA' },