function formatAddress
formatAddress(): string

Assembles a single address string from its parts — the inverse of splitAddress.

Components that are absent or blank are skipped. With prefix on (the default) each component is introduced by its administrative word, switching to แขวง / เขต automatically when the province is Bangkok.

Examples

Example 1

formatAddress({ address: '99/9', subDistrict: 'ศรีภูมิ', district: 'เมืองเชียงใหม่', province: 'เชียงใหม่', postalCode: '50200', }); // "99/9 ตำบลศรีภูมิ อำเภอเมืองเชียงใหม่ จังหวัดเชียงใหม่ 50200"

Example 2

formatAddress(parts, { prefix: false, separator: ', ' }); // "99/9, ศรีภูมิ, เมืองเชียงใหม่, เชียงใหม่, 50200"

Parameters

optional
options: FormatAddressOptions

Return Type

string

Usage

import { formatAddress } from ".";