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

Commit 15691a9

Browse files
refactor: use string enum for SanitizeTypes
1 parent 38a69f1 commit 15691a9

File tree

2 files changed

+19
-17
lines changed

2 files changed

+19
-17
lines changed

src/enums/sanitize-type.enum.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
/**
22
* Sanitation types.
33
*/
4-
export enum SanitizeTypes {
5-
BLACKLIST = 1,
6-
ESCAPE = 2,
7-
LTRIM = 3,
8-
NORMALIZE_EMAIL = 4,
9-
RTRIM = 5,
10-
STRIP_LOW = 6,
11-
TO_BOOLEAN = 7,
12-
TO_DATE = 8,
13-
TO_FLOAT = 9,
14-
TO_INT = 10,
15-
TO_STRING = 11,
16-
TRIM = 12,
17-
WHITELIST = 13,
18-
CUSTOM_SANITIZATION = 9999,
19-
NESTED = 1000,
4+
export const enum SanitizeTypes {
5+
BLACKLIST = 'BLACKLIST',
6+
ESCAPE = 'ESCAPE',
7+
LTRIM = 'LTRIM',
8+
NORMALIZE_EMAIL = 'NORMALIZE_EMAIL',
9+
RTRIM = 'RTRIM',
10+
STRIP_LOW = 'STRIP_LOW',
11+
TO_BOOLEAN = 'TO_BOOLEAN',
12+
TO_DATE = 'TO_DATE',
13+
TO_FLOAT = 'TO_FLOAT',
14+
TO_INT = 'TO_INT',
15+
TO_STRING = 'TO_STRING',
16+
TRIM = 'TRIM',
17+
WHITELIST = 'WHITELIST',
18+
CUSTOM_SANITIZATION = 'CUSTOM_SANITIZATION',
19+
NESTED = 'NESTED',
2020
}

src/interfaces/metadata/sanitation-metadata.interface.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
1+
import { SanitizeTypes } from '../../enums';
2+
13
/**
24
* This metadata interface contains information for sanitation.
35
*/
46
export interface SanitationMetadata {
57
/**
68
* Sanitation type.
79
*/
8-
type: number;
10+
type: SanitizeTypes;
911

1012
/**
1113
* Object that is used to be sanitized.

0 commit comments

Comments
 (0)