utils/pickForOrientation.jsjavascript
/**
 * Resolves a content value that may be authored per orientation: either a
 * single value used in every orientation, or a `{ landscape, portrait }` pair
 * (schema: `$defs.orientedAssetPath` in schemas/content.schema.json). Used
 * with `useStageOrientation()` so e.g. Rad Enablement's screensaver and slide
 * thumbnails follow the orientation Stage currently renders in.
 *
 * @param {string|{landscape: string, portrait: string}|undefined} entry
 * @param {"landscape"|"portrait"} orientation
 * @returns {string|undefined}
 */
export const pickForOrientation = (entry, orientation) =>
  typeof entry === "string" ? entry : entry?.[orientation];