Built-in Normalizers

between

Normalize the value to the specified range.

Parameters:

  • min: number
  • max: number

Example:

{
  between: {
    min: 10,
    max: 20,
  },
}

betweenWith

Normalize the value to the specified range with other field values.

Parameters:

  • min: string
  • max: string

Example:

{
  between: {
    min: 'minKey',
    max: 'maxKey',
  },
}

escape

Replace <, >, &, ', " and / with HTML entities.

Parameters:

  • None

Example:

{
  escape: true,
}

Reference:

lowercase

Replace the character string with lowercase letters.

Parameters:

  • None

Example:

{
  lowercase: true,
}

ltrim

Trim characters from the left-side of the input.

Parameters:

  • string

Example:

{
  ltrim: true,

  // -- or --

  ltrim: '@',
}

max

Normalize the value to less than or equal to the specified number.

Parameters:

  • number

Example:

{
  max: 100,
}

maxWith

Normalize the value to less than or equal to the specified field value.

Parameters:

  • string

Example:

{
  max: 'maxKey',
}

min

Normalize the value to greater than or equal to the specified number.

Parameters:

  • number

Example:

{
  min: 100,
}

minWith

Normalize the value to greater than or equal to the specified field value.

Parameters:

  • string

Example:

{
  min: 'minKey',
}

numberWithCommas

Normalize to comma-separated numbers. (For example look at here)

Parameters:

  • None

Example:

{
  numberWithCommas: true,
}

rtrim

Trim characters from the right-side of the input.

Parameters:

  • string

Example:

{
  rtrim: true,

  // -- or --

  rtrim: '/',
}

toBoolean

Converts a value to a Boolean.

false:

  • "0"
  • "false"
  • falsy

true:

  • truthy

Parameters:

  • None

Example:

{
  toBoolean: true,
}

toDate

Converts a value to a Date.

Parameters:

  • None

Example:

{
  toDate: true,
}

toFloat

Converts a value to a float number.

Parameters:

  • None

Example:

{
  toFloat: true,
}

toInt

Converts a value to a integer.

Parameters:

  • radix?: number

Example:

{
  toInt: true,

  // -- or --

  toInt: { radix: 16 },
}

toString

Converts a value to a string.

Parameters:

  • None

Example:

{
  toString: true,
}

unescape

Replaces HTML encoded entities with <, >, &, ', " and /.

Parameters:

  • None

Example:

{
  unescape: true,
}

uppercase

Replace the character string with uppercase letters.

Parameters:

  • None

Example:

{
  uppercase: true,
}

results matching ""

    No results matching ""