Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/utils / src / formatOrderStatus.ts
Size: Mime:
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