Repository URL to install this package:
|
Version:
1.0.10 ▾
|
import { isString, EMPTY_STRING } from 'exotic'
const ORDER_STATUS_LABEL = {
'NONE': 'None',
'ONHOLD': 'On hold',
'SUBMITTED': 'Submitted',
'READYTOEDIT': 'Ready to edit',
'FREEZEEDIT': 'Freeze edit',
'SUBMITTEDTOFULFILMENT': 'Submitted to fulfillment',
'READYTOSHIP': 'Ready to ship',
'SHIPPED': 'Shipped',
'RETURNSUBMITTED': 'Return submitted',
'UNABLETOSHIP': 'Unable to ship',
// Cancelled in India/British english
'CANCELED': 'Canceled',
'DELIVERED': 'Delivered',
'STANDARD_DELIVERY': 'Standard Delivery',
}
function formatOrderStatus(status: string): string {
/**
* @todo @fixme @invalid
* @note @ganesh
* this is bad performance
* obviously was copied from formatPrice which is @deprecated
* this is not a reusable util, this is a domain specific data
*/
if (isString(status)) {
return ORDER_STATUS_LABEL[status] || EMPTY_STRING
} else {
return 'N/A'
}
// try {
// return ORDER_STATUS_LABEL[status]
// } catch (error) {
// return 'N/A'
// }
}
export { formatOrderStatus }
export default formatOrderStatus