mapCourierStatus
function mapCourierStatus(courier, raw): | CourierStatus | null;Defined in: courier.ts:133
Maps a courier’s own status (its name, numeric ID or code, as the courier documents it) to a CourierStatus.
Matching ignores case and extra spaces. PostEx’s “Attempt Made: attempted.
Only statuses the courier documents publicly are mapped: PostEx’s API
guide and one Leopards status. TCS, M&P, Trax and BlueEx publish no list,
so they always return null, as does any status not in the list. No API
is called.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
courier |
string |
TCS, Leopards, PostEx, M&P, Trax or BlueEx (case-insensitive; LCS, MnP and Blue Ex are accepted) |
raw |
string | number |
The status as the courier returned it |
Returns
Section titled “Returns”| CourierStatus
| null
The status, or null. Never throws.
Only PostEx and one Leopards status are mapped so far. The
mapping and the CourierStatus values may change in a minor release
as other couriers’ lists are added.