resolveCodec = (codecOrGetter, value) => {
  if (typeof codecOrGetter === 'function') {
    const codec = codecOrGetter(value);
    if (typeof codec !== 'object' || codec === null) {
      throw Error('Codec function must return a codec');
    }
    return codec;
  }
  if (typeof codecOrGetter === 'string') {
    const codec = SimpleValueCodecs[codecOrGetter];
    if (!codec) {
      throw Error(
        `Unexpected value type ${quote(codecOrGetter)}, expected one of ${Object.keys(SimpleValueCodecs).join(', ')}`,
      );
    }
    return codec;
  }
  if (typeof codecOrGetter === 'object' && codecOrGetter !== null) {
    return codecOrGetter;
  }
  throw Error(`Unexpected codec or getter ${quote(codecOrGetter)}`);
}
@param {ResolvableCodec} codecOrGetter
@param {any} [value]
@returns {SyrupCodec}
This is a helper function that resolves a codec or getter to a codec.