All files / lastwill/utilities grammar.utils.ts

94.73% Statements 18/19
90% Branches 9/10
100% Functions 2/2
93.33% Lines 14/15

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 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 314x   4x       12x       2x   4x   1x   3x 2x   1x   2x       4x 18x 17x 5x    
import { Gender, PersonType } from '../../db/entities/lastwill.entity'
 
export function getPossessivePronouns(
  type: PersonType,
  gender: Gender,
): string {
  switch (type) {
    case PersonType.PARTNER:
      return 'Mein Partner'
    case PersonType.CHILD:
      return 'Mein Kind'
    case PersonType.FATHER:
      return 'Mein Vater'
    case PersonType.MOTHER:
      return 'Meine Mutter'
    case PersonType.SIBLING:
      if (gender === Gender.FEMALE) return 'Meine Schwester'
      if (gender === Gender.MALE) return 'Mein Bruder'
      // Assuming gender neutral siblings are referred to as Geschwisterkind
      return 'Mein Geschwisterkind'
    default:
      return 'Mein Verwandter'
  }
}
 
export function joinStringArrayForSentence(arr: string[]): string {
  if (arr.length === 0) return null
  if (arr.length === 1) return arr.at(-1)
  return `${arr.slice(0, -1).join(', ')} und ${arr.at(-1)}`
}