Options
All
  • Public
  • Public/Protected
  • All
Menu

Module utils

Index

Functions

Const checkBuildingRange

  • checkBuildingRange(building_name: string): void | BuildingRangeMatch
  • Detects whether a building name contains a range

    Parameters

    • building_name: string

    Returns void | BuildingRangeMatch

Const combinePremise

  • combinePremise(elems: AddressElements, address: Address, premise: string, number: string, unit: string): FormattedPremise
  • Merges premise elements ordered by precedence into a formatted address

    Parameters

    • elems: AddressElements
    • address: Address
    • premise: string
    • number: string
    • unit: string

    Returns FormattedPremise

Const formatElem

  • formatElem(e: string): string
  • Formats an address element

    • If a single letter element, suffix a comma
    • Otherwise return address element

    Parameters

    • e: string

    Returns string

Const hasUnitPrefix

  • hasUnitPrefix(e: string): boolean
  • Test for whether a string begins with a unit prefix

    E.g. Back of 10A => true

    Parameters

    • e: string

    Returns boolean

Const isSingleCharacter

  • isSingleCharacter(c: string): boolean
  • Returns true if string matches rule (iii) of exception rule (above)

    Parameters

    • c: string

    Returns boolean

Const lastElem

  • lastElem(a: AddressElements): string
  • Non-desctructively return last elem

    Parameters

    • a: AddressElements

    Returns string

Const nameException

  • nameException(n: string): boolean
  • Exception Rule indicators: i) First and last characters of the Building Name are numeric (eg ‘1to1’ or ’100:1’) ii) First and penultimate characters are numeric, last character is alphabetic (eg 12A’) iii) Building Name has only one character (eg ‘A’)

    Parameters

    • n: string

    Returns boolean

Const premiseLocalities

  • premiseLocalities(address: Address): AddressElements
  • Returns an array of localities according to precedent recorded in localityElements

    Parameters

    Returns AddressElements