{
  base_url: (subdomain) => 'https://' + subdomain + '.aha.io/api/v1',

  build_query_string: (params) =>
    Object.entries(params)
      .filter(e => e[1] != null && e[1] != '')
      .map(e => encodeURIComponent(e[0]) + '=' + encodeURIComponent(e[1]))
      .join('&'),

  safe_str: (val) => (val != null ? '' + val : ''),

  safe_int: (val, fallback) => (val != null && !isNaN(parseInt(val)) ? parseInt(val) : fallback),

  format_epic: (e) => e.reference_num + ' - ' + e.name + ' [' + (e.workflow_status != null ? e.workflow_status.name : 'No Status') + ']',

  format_feature: (f) => f.reference_num + ' - ' + f.name + ' [' + (f.workflow_status != null ? f.workflow_status.name : 'No Status') + ']',

  format_idea: (i) => i.reference_num + ' - ' + i.name + ' (' + (i.workflow_status != null ? i.workflow_status.name : 'No Status') + ', ' + (i.vote_count != null ? i.vote_count : 0) + ' votes)',

  format_product: (p) => (p.reference_prefix != null ? p.reference_prefix : p.id) + ' - ' + p.name + (p.product_line != null ? ' [' + p.product_line.name + ']' : '')
}
