Skip to content

The open alternative to Salesforce, designed for AI.

364 B
Raw Blame
import { isNonEmptyString } from '@sniptt/guards';

const COPY_SUFFIX = '(Copy)';
const COPY_SUFFIX_LOWERCASE = '(copy)';

export const appendCopySuffix = (value: string): string => {
  if (!isNonEmptyString(value)) {
    return value;
  }

  if (value.toLowerCase().endsWith(COPY_SUFFIX_LOWERCASE)) {
    return value;
  }

  return `${value} ${COPY_SUFFIX}`;
};