function getFullStoryType()

in src/shippers/fullstory/src/get_properties_and_schema.ts [78:104]


function getFullStoryType(value: unknown) {
  // For arrays, make the decision based on the first element
  const isArray = Array.isArray(value);
  const v = isArray ? value[0] : value;
  let type: string;
  switch (typeof v) {
    case 'string':
      type = moment(v, moment.ISO_8601, true).isValid() ? 'date' : 'str';
      break;
    case 'number':
      type = Number.isInteger(v) ? 'int' : 'real';
      break;
    case 'boolean':
      type = 'bool';
      break;
    case 'object':
      if (isDate(v)) {
        type = 'date';
        break;
      }
    default:
      throw new Error(`Unsupported type: ${typeof v}`);
  }

  // convert to plural form for arrays
  return isArray ? `${type}s` : type;
}