# mapCourierStatus

Source: https://pakdatakit.dev/api/typescript/courier/functions/mapcourierstatus/

```ts
function mapCourierStatus(courier, raw): 
  | CourierStatus
  | null;
```

Defined in: [courier.ts:133](https://github.com/chmuzamil/pakdatakit/blob/a6eeaa47381308c4e4fcda45b29642fe4fbfb1fc/src/courier.ts#L133)

Maps a courier's own status (its name, numeric ID or code, as the courier
documents it) to a [CourierStatus](https://pakdatakit.dev/api/typescript/courier/type-aliases/courierstatus/).

Matching ignores case and extra spaces. PostEx's "Attempt Made: <reason>"
history messages map to `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.

> **Experimental**
>
> This API should not be used in production and may be trimmed from a public release.
## 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

  \| [`CourierStatus`](https://pakdatakit.dev/api/typescript/courier/type-aliases/courierstatus/)
  \| `null`

The status, or `null`. Never throws.
 Only PostEx and one Leopards status are mapped so far. The
mapping and the [CourierStatus](https://pakdatakit.dev/api/typescript/courier/type-aliases/courierstatus/) values may change in a minor release
as other couriers' lists are added.
