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

getStateFromIndianPostcodefunction

The state or union territory a PIN code is in, by its code without IN- (KA for Karnataka): the one most of GeoNames' places for the PIN code are in.

Import it

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

Definition

function getStateFromIndianPostcode(postcode: string): string | undefined

Parameters

NameTypeDescription
postcodestring

The PIN code.

Returns

string | undefined

The state's code, or undefined when the list does not have the PIN code.

Examples

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

console.log(["560038", "110001", "400001", "600001", "999999"].map(getStateFromIndianPostcode));
// → ["KA","DL","MH","TN",null]
[ 'KA', 'DL', 'MH', 'TN', undefined ]

What it prints (run when this page was built)

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