Skip to content

The open alternative to Salesforce, designed for AI.

273 B
Raw Blame
import { isNonEmptyString, isString } from '@sniptt/guards';

export const toText = (value: unknown): string | undefined => {
  if (!isString(value)) {
    return undefined;
  }

  const trimmed = value.trim();

  return isNonEmptyString(trimmed) ? trimmed : undefined;
};