function formatValue(value, type) {
  const valueAsString = String(value);

  switch (type) {
    case 'boolean': {
      return valueAsString !== 'false';
    }

    case 'string': {
      return valueAsString;
    }

    case 'number': {
      return parseInt(valueAsString, 10);
    }

    case 'object': {
      return parse(valueAsString);
    }
  }
}
Converts input to string and then coerces to the appropriate title.

@param {unknown} value
@param {string} type

@return {unknown}