Options
All
  • Public
  • Public/Protected
  • All
Menu

Postcode

This wraps an input postcode string and provides instance methods to validate, normalise or extract postcode data.

This API is a bit more cumbersome that it needs to be. You should favour Postcode.parse() or a static method depending on the task at hand.

Hierarchy

  • Postcode

Index

Constructors

constructor

  • new Postcode(postcode: string): Postcode
  • Parameters

    • postcode: string

    Returns Postcode

Properties

Static isValid

isValid: Validator = isValid

Static toArea

toArea: Parser = toArea

Static toDistrict

toDistrict: Parser = toDistrict

Static toIncode

toIncode: Parser = toIncode

Static toNormalised

toNormalised: Parser = toNormalised

Static toOutcode

toOutcode: Parser = toOutcode

Static toSector

toSector: Parser = toSector

Static toSubDistrict

toSubDistrict: Parser = toSubDistrict

Static toUnit

toUnit: Parser = toUnit

Methods

area

  • area(): string | null
  • Returns string | null

district

  • district(): string | null
  • Returns string | null

incode

  • incode(): string | null
  • Returns string | null

normalise

  • normalise(): string | null
  • Returns string | null

outcode

  • outcode(): string | null
  • Returns string | null

sector

  • sector(): string | null
  • Returns string | null

subDistrict

  • subDistrict(): string | null
  • Returns string | null

unit

  • unit(): string | null
  • Returns string | null

valid

  • valid(): boolean
  • Returns boolean

Static parse

Static validOutcode

  • validOutcode(outcode: string): boolean
  • Parameters

    • outcode: string

    Returns boolean