Strips characters a US postal code can never contain, so invalid input never
renders. Keeps the hyphen, which ZIP+4 needs. Non-US postal codes must not be
passed through this — many are alphanumeric.
Parameters
postalCode: string
The raw input to mask.
Returns string
The input with everything but digits and hyphens removed.
Strips characters a US postal code can never contain, so invalid input never renders. Keeps the hyphen, which ZIP+4 needs. Non-US postal codes must not be passed through this — many are alphanumeric.