Options
All
  • Public
  • Public/Protected
  • All
Menu

These are the data conversion functions provided by the runtime-data-validation package. These functions handle converting string values into a native data format. Since the validation functions all validate string data, and since we often want to store data in a native format like the Date object, we need to convert from the string representation to the native format.

USAGE:

import {
conversions, validations
} from 'runtime-data-validation';

function operation(value: string) {
if (validations.isFloat(value)) {
let num = conversions.ToFloat(value);
}
}

Return to home page

Index

Conversion

  • ToBoolean(bool: string | boolean): boolean
  • ToDate(date: string | Date): Date
  • Converts a date string to a Date object.

    Parameters

    • date: string | Date

    Returns Date

  • ToFloat(value: string | number): number
  • ToInt(value: string | number): number