File size: 364 Bytes
d9494a5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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}`;
};