The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
import { isUndefined } from '@sniptt/guards';
import { asRecord } from 'src/logic-functions/utils/asRecord';
import { getString } from 'src/logic-functions/utils/getString';
export const extractRichTextMarkdown = (
rawValue: string,
): string | undefined => {
try {
const richTextValue = asRecord(JSON.parse(rawValue));
if (isUndefined(richTextValue)) {
return getString(rawValue);
}
return getString(richTextValue.markdown);
} catch {
return getString(rawValue);
}
};