Skip to content

parent

parent(code): Postcode | null

Returns the postcode one segment less precise, such as the area of a building.

Postcode

A parsed postcode.

Postcode | null

The parent postcode, or null for a state code.

const building = parse('EK-01-A03-FK-01');
if (building.ok) {
parent(building.value)?.canonical; // 'EK-01-A03-FK'
}

Unofficial. Not made or endorsed by NIPOST.