fix(tech): Replaced replaceAll methods with replace to avoid errors in some older browsers.
Squashed commit of the following: commit 559c099720500a5fa55d92456cc555ab5d980e1f Author: Erik Tiekstra <erik.tiekstra@arbetsformedlingen.se> Date: Thu Oct 14 13:14:16 2021 +0200 Replaced replaceAll with replace method with regex to avoid older browser-problems
This commit is contained in:
@@ -33,7 +33,7 @@ export class EmployeeInviteComponent {
|
||||
|
||||
get emailsControlValueAsArray(): string[] {
|
||||
return (this.emailsControl.value as string)
|
||||
.replaceAll(/\n|\t|\r/g, '')
|
||||
.replace(/\n|\t|\r/g, '')
|
||||
.split(/[\s,;:]+/)
|
||||
.filter(email => !!email);
|
||||
}
|
||||
|
||||
@@ -63,9 +63,6 @@ export class LayoutComponent extends UnsubscribeDirective {
|
||||
}
|
||||
|
||||
get breadcrumbsItems(): NavigationBreadcrumbsItem[] {
|
||||
return this._breadcrumbsItems$.getValue().map(breadcrumb => ({
|
||||
...breadcrumb,
|
||||
text: breadcrumb.text.replaceAll('-', ' '),
|
||||
}));
|
||||
return this._breadcrumbsItems$.getValue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ export function mapResponseToContactInformation(data: ContactInformationResponse
|
||||
firstName: fornamn || '',
|
||||
lastName: efternamn || '',
|
||||
fullName: fornamn && efternamn ? `${fornamn} ${efternamn}` : '',
|
||||
ssn: personnummer ? mapStringToSsn(personnummer) : '',
|
||||
ssn: mapStringToSsn(personnummer),
|
||||
email: epost || '',
|
||||
phoneNumbers: telekomadresser
|
||||
? telekomadresser
|
||||
|
||||
@@ -57,7 +57,7 @@ export function mapResponseToEmployee(data: EmployeeResponse): Employee {
|
||||
lastName,
|
||||
fullName: `${firstName} ${lastName}`,
|
||||
email,
|
||||
ssn: ssn ? mapStringToSsn(ssn) : null,
|
||||
ssn: mapStringToSsn(ssn),
|
||||
roles: roles || [],
|
||||
tjanster: tjanster?.map(tjanst => mapResponseToEmployeeTjanst(tjanst)),
|
||||
allaUtforandeVerksamheter,
|
||||
|
||||
@@ -9,7 +9,7 @@ export function mapPathsToBreadcrumbs(
|
||||
let breadcrumbs = [
|
||||
...(startBreadcrumb ? [startBreadcrumb] : []),
|
||||
...paths.map((path, index) => ({
|
||||
text: mapPathToPageName(path),
|
||||
text: mapPathToPageName(path).replace(/-/g, ' '),
|
||||
routerLink: `/${paths.slice(0, index + 1).join('/')}`,
|
||||
})),
|
||||
];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const CURRENT_YEAR = new Date().getFullYear().toString().slice(2, 4);
|
||||
|
||||
export function mapStringToSsn(ssn: string): string {
|
||||
ssn = ssn.replaceAll('-', '');
|
||||
ssn = (ssn || '').replace(/-/g, '');
|
||||
if (ssn.length === 10) {
|
||||
const century = +CURRENT_YEAR - +ssn.slice(0, 2) > 0 ? '20' : '19';
|
||||
ssn = ssn.padStart(12, century);
|
||||
|
||||
@@ -25,7 +25,7 @@ export function CommaSeparatedEmailValidator(): ValidatorFn {
|
||||
if (control && control.value) {
|
||||
const values: string[] = (control.value as string)
|
||||
.toLowerCase()
|
||||
.replaceAll(/\n|\t|\r/g, '')
|
||||
.replace(/\n|\t|\r/g, '')
|
||||
.split(/[\s,;:]+/);
|
||||
const invalidEmailaddresses = [];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user