Skip to content
This repository was archived by the owner on Jun 1, 2025. It is now read-only.

Commit 7973645

Browse files
Ghislain BeaulacGhislain Beaulac
authored andcommitted
refactor(formatter): remove Mask Formatter unnecessary code
1 parent aa4cab5 commit 7973645

File tree

1 file changed

+1
-10
lines changed

1 file changed

+1
-10
lines changed

src/app/modules/angular-slickgrid/formatters/maskFormatter.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,7 @@ export const maskFormatter: Formatter = (row: number, cell: number, value: any,
1616
if (value) {
1717
let i = 0;
1818
const v = value.toString();
19-
return mask.replace(/[09A]/gi, (match: string) => {
20-
// only replace the char when the mask is a 0 or 9 for a digit OR the mask is "A" and the char is a non-digit meaning a string char
21-
if (
22-
((match === '0' || match === '9') && /\d*/g.test(v[i])) // mask is 0 or 9 and value is a digit
23-
|| (match.toUpperCase() === 'A' && /[^\d]*/gi.test(v[i])) // OR mask is an "A" and value is non-digit
24-
) {
25-
return v[i++] || '';
26-
}
27-
return '';
28-
});
19+
return mask.replace(/[09A]/gi, () => v[i++] || '');
2920
}
3021
return value;
3122
};

0 commit comments

Comments
 (0)