Skip to main content

Sanitizers

@quik/entity


@quik/entity / Sanitizers

Variable: Sanitizers

const Sanitizers: object

Defined in: entity/src/decorators/Sanitizers.ts:13

Collection of sanitizer decorators for entity fields.

Sanitizers transform field values when set, ensuring consistent formats.

Type Declaration​

Blacklist()​

Blacklist(chars): (target, context) => void

Removes all occurrences of provided characters from the string.

Parameters​

chars​

string

Characters to remove

Returns​

(target, context) => void

Email()​

Email(): (target, context) => void

Normalizes email addresses to a consistent format.

Returns​

(target, context) => void

Escape()​

Escape(): (target, context) => void

Escapes HTML special characters in the string.

Returns​

(target, context) => void

LeftTrim()​

LeftTrim(chars?): (target, context) => void

Trim characters from the start of the value.

Parameters​

chars?​

string

Characters to trim from the beginning.

Returns​

(target, context) => void

RightTrim()​

RightTrim(chars?): (target, context) => void

Trim characters from the end of the value.

Parameters​

chars?​

string

Characters to trim from the end.

Returns​

(target, context) => void

Slugify()​

Slugify(baseField?): (target, context) => void

Generate a slug for the field.

Parameters​

baseField?​

string

Use the value of this field instead of the decorated one.

Returns​

(target, context) => void

StripHtml()​

StripHtml(): (target, context) => void

Removes all HTML tags from the string.

Returns​

(target, context) => void

StripLow()​

StripLow(keepNewLines?): (target, context) => void

Remove control characters from the value.

Parameters​

keepNewLines?​

boolean

Preserve newline characters when stripping.

Returns​

(target, context) => void

Trim()​

Trim(chars?): (target, context) => void

Trim characters from both sides of the value.

Parameters​

chars?​

string

Characters to trim.

Returns​

(target, context) => void

Unescape()​

Unescape(): (target, context) => void

Unescapes HTML special characters in the string.

Returns​

(target, context) => void

Url()​

Url(): (target, context) => void

Normalizes URLs by fixing duplicate slashes and ensuring proper protocol format.

Returns​

(target, context) => void

Whitelist()​

Whitelist(chars?): (target, context) => void

Remove all characters except for those provided.

Parameters​

chars?​

string

The allowed characters.

Returns​

(target, context) => void