Skip to content

v2.0.0

Latest

Choose a tag to compare

@sirlisko sirlisko released this 08 Oct 19:45
003a1f7

Breaking

  • Stricter validation. Postcodes are now checked against the per-position letter rules from BS 7666, and the whole string must match. These were accepted by 1.x and are now rejected:
    • text around a postcode, e.g. "GIR0AA nonsense"
    • letters not used in a given position, e.g. "Q1 1AA", "N7 7CA", "ZZ99 9ZZ"
  • Build targets ES2017 instead of ES5.

Features

  • Named isValid export: import { isValid } from "uk-postcode-validator" or const { isValid } = require("uk-postcode-validator"). The default export still works.
  • Surrounding whitespace and repeated spaces between the outward and inward codes are now accepted.