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
| Name | Type | Description |
|---|---|---|
postcode | string | 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)