export function formatter(num) {
  if (isNaN(num) || !num) return 0;
  let n = num.toString().split('.');
  let number = n[0].replace(/\B(?=(\d{3})+(?!\d))/g, ',');
  if (n[1]) number = number + '.' + n[1];
  return number;
}

export function defaultAppNameFunc(list, key) {
  let appName = '';
  const defaultName = '起点新闻';
  for (let i = 0; i < list.length; i++) {
    const v = list[i];
    
    if (v[key || 'value'] === defaultName) {
      appName = defaultName;
      break;
    }
  }
  if (!appName) appName = list[0][key || 'value'];
  return appName;
}
