Skip to the content

address-plusアドレスプラス

Parse, validate, format and compare addresses locally, add country modules and mount an optional native form field.

address-plus extends the parse-address style with typed results, validation, formatting and country modules. About the name

Contents

Reference · /in

isValidIndianPostcodefunction

Whether a PIN code follows India Post's shape: six digits, the first not nought, with or without a space after the third. Whether it is in use is a different question; isKnownIndianPostcode asks it, and the validator checks both.

Import it

import { isValidIndianPostcode } from "@johnmorrisdotca/address-plus/in";

Definition

function isValidIndianPostcode(postcode: string): boolean

Parameters

NameTypeDescription
postcodestring

The PIN code.

Returns

boolean

true when it has the shape.

Examples

import { isValidIndianPostcode } from "@johnmorrisdotca/address-plus/in";

console.log(["560038", "560 038", "060038", "56003", "5600381"].map(isValidIndianPostcode));
// → [true,true,false,false,false]
[ true, true, false, false, false ]

What it prints (run when this page was built)

View sourceEdit on GitHubMade from the source of @johnmorrisdotca/address-plus 1.10.2.