contains
contains(
prefix,code):boolean
Tells whether a postcode lies inside another postcode. A postcode contains itself.
Parameters
Section titled “Parameters”prefix
Section titled “prefix”The larger postcode, such as a district.
The postcode to test.
Returns
Section titled “Returns”boolean
True when code has each segment of prefix in the same place.
Example
Section titled “Example”const district = parse('EK-01-A03', { allowPartial: true });const building = parse('EK-01-A03-FK-01');if (district.ok && building.ok) { contains(district.value, building.value); // true}Unofficial. Not made or endorsed by NIPOST.