UNPKG

@prismicio/client

Version:

The official JavaScript + TypeScript client library for Prismic

20 lines (19 loc) 736 B
//#region src/lib/getOptionalLinkProperties.ts /** * Returns optional properties only available to link fields. Link fields can have the same shape as * content relationship and link to media fields, requiring special treatment to extract * link-specific properties. * * @param input - The content relationship or link to media field from which the link properties * will be extracted. * @returns Optional link properties that `input` might have. */ const getOptionalLinkProperties = (input) => { const res = {}; if ("text" in input) res.text = input.text; if ("variant" in input) res.variant = input.variant; return res; }; //#endregion export { getOptionalLinkProperties }; //# sourceMappingURL=getOptionalLinkProperties.js.map