subdivisionByShortCodefunction
One subdivision by its country and the part of its code after the hyphen.
Import it
import { subdivisionByShortCode } from "@johnmorrisdotca/kuni/subdivisions";
Definition
function subdivisionByShortCode(countryCode: string, shortCode: string): Subdivision | null
Parameters
| Name | Type | Description |
|---|---|---|
countryCode | string | An alpha-2 code, either case. |
shortCode | string | The part after the hyphen: "ON", "13". |
Returns
Subdivision | null
The subdivision, frozen; null where the two make no code.
Examples
import { subdivisionByShortCode } from "@johnmorrisdotca/kuni/subdivisions";
console.log(subdivisionByShortCode("CA", "ON")?.code); // "CA-ON"
console.log(subdivisionByShortCode("JP", "99")); // nullCA-ON
nullWhat it prints (run when this page was built)