const CURRENT_YEAR = new Date().getFullYear().toString().slice(2, 4);

export function mapStringToSsn(ssn: string): string {
  ssn = ssn.replaceAll('-', '');
  if (ssn.length === 10) {
    const century = +CURRENT_YEAR - +ssn.slice(0, 2) > 0 ? '20' : '19';
    ssn = ssn.padStart(12, century);
  }
  if (ssn.length === 12) {
    ssn = `${ssn.slice(0, 8)}-${ssn.slice(8, 12)}`;
  }
  return ssn;
}
