1.0.2 • Published 6 years ago
@fmtk/postcodes v1.0.2
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' } }