Validate Sri Lankan postal codes and find their district and province.
Import from lanka-validations/postal-code, or from the package root.
lanka-validations/postal-code
Checks the five-digit format and the two-digit routing prefix. It does not confirm that a specific post office uses the code.
import { isValidPostalCode, lookupPostalCode } from 'lanka-validations/postal-code';isValidPostalCode('00100'); // truelookupPostalCode('20000')?.district; // 'Kandy' Copy
import { isValidPostalCode, lookupPostalCode } from 'lanka-validations/postal-code';isValidPostalCode('00100'); // truelookupPostalCode('20000')?.district; // 'Kandy'
Validate Sri Lankan postal codes and find their district and province.
Import from
lanka-validations/postal-code, or from the package root.Checks the five-digit format and the two-digit routing prefix. It does not confirm that a specific post office uses the code.
Example