Skip to content

isLegacy

isLegacy(input): boolean

Tells whether text is an old 6-digit NIPOST postcode. A legacy postcode names an area, not a building. Like parse, it applies the input limit before it normalises, so long text cannot stall a server.

string

Text from a user.

boolean

True when the input is within the input limit and exactly 6 ASCII digits remain after normalisation.

isLegacy('900 108'); // true
isLegacy('EK-01-A03-FK-01'); // false

Unofficial. Not made or endorsed by NIPOST.