All files / packages / shared/src fold.ts

100% Statements 1/1
100% Branches 0/0
100% Functions 1/1
100% Lines 1/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6      6x    
// One fold for names, people search and the FTS index, so stored text and queries always match (design 4.13).
// đ has no combining mark under NFD, so it is mapped on its own.
export function fold(text: string): string {
  return text.toLowerCase().normalize('NFD').replace(/\p{M}/gu, '').replace(/đ/g, 'd')
}