Skip to content

Latest commit

 

History

History
49 lines (39 loc) · 1.09 KB

README.md

File metadata and controls

49 lines (39 loc) · 1.09 KB

Postcodes

Information about UK postcode areas and districts. Based on data prepared by Chris Bell, Originally from the Office For National Statistics Open Geography Portal.

API

export interface PostcodeArea {
  code: string;
  name: string;
}

export interface PostcodeDistrict {
  code: string;
  name: string;
  area: PostcodeArea;
}

export function getPostcodeDistrict(code: string): PostcodeDistrict;
export function getPostcodeArea(code: string): PostcodeDistrict;

Examples

const district = getPostcodeDistrict('E2');
district = {
  code: 'E3',
  name:
    'Bow, Bromley-by-Bow, Old Ford, Mile End, Three Mills, London Gas Museum',
  area: {
    code: 'E',
    name: 'East London',
  },
};

CLI

$ node cli.js E3
Looking up district E3
{ code: 'E3',
  name: 'Bow, Bromley-by-Bow, Old Ford, Mile End, Three Mills, London Gas Museum',
  area: { name: 'East London' } }