JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 12
  • Score
    100M100P100Q22223F
  • License MIT

A simple JS package to validate different country's pincodes

Package Exports

  • pincode-js
  • pincode-js/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pincode-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pincode-js

A lightweight JS module for parsing and validating postcodes. Country specific validation is supported for most countries including GB, US, Canada, Japan and many others.

Install

npm install pincode-js

Usage

// commonjs
const { pincodeValidator, pincodeValidatorExistsForCountry } = require('pincode-js');
// ES6
import { pincodeValidator, pincodeValidatorExistsForCountry } from 'pincode-js';

pincodeValidator('W85TT', 'GB'); // returns true
pincodeValidator('1234567', 'GB'); // returns false

pincodeValidatorExistsForCountry('GB'); // returns true
pincodeValidatorExistsForCountry('Moon'); // returns false

country codes: US, GB, CA, JP, INTL(International), etc