@prismicio/client
Version:
The official JavaScript + TypeScript client library for Prismic
1 lines • 1.13 kB
Source Map (JSON)
{"version":3,"file":"getOptionalLinkProperties.cjs","names":["res: OptionalLinkProperties"],"sources":["../../src/lib/getOptionalLinkProperties.ts"],"sourcesContent":["import type { OptionalLinkProperties } from \"../types/value/link\"\n\n/**\n * Returns optional properties only available to link fields. Link fields can\n * have the same shape as content relationship and link to media fields,\n * requiring special treatment to extract link-specific properties.\n *\n * @param input - The content relationship or link to media field from which the\n * link properties will be extracted.\n *\n * @returns Optional link properties that `input` might have.\n */\nexport const getOptionalLinkProperties = (\n\tinput: OptionalLinkProperties,\n): OptionalLinkProperties => {\n\tconst res: OptionalLinkProperties = {}\n\n\tif (\"text\" in input) {\n\t\tres.text = input.text\n\t}\n\n\tif (\"variant\" in input) {\n\t\tres.variant = input.variant\n\t}\n\n\treturn res\n}\n"],"mappings":";;;;;;;;;;;;AAYA,MAAa,6BACZ,UAC4B;CAC5B,MAAMA,MAA8B,EAAE;AAEtC,KAAI,UAAU,MACb,KAAI,OAAO,MAAM;AAGlB,KAAI,aAAa,MAChB,KAAI,UAAU,MAAM;AAGrB,QAAO"}