Options
All
  • Public
  • Public/Protected
  • All
Menu

simple-js-validator

Simple.Js.Validator v2.0.0

Index

Properties

default

default: { assertIsDefined: (toAssertName: string, thing: any) => void; assertIsEmpty: (toAssertName: string, thing: any) => void; assertIsNotDefined: (toAssertName: string, thing: any) => void; assertIsNotEmpty: (toAssertName: string, thing: any) => void; isArray: (thing: any) => boolean; isDefined: (thing: any) => boolean; isEmpty: (thing: any) => boolean; isEmptyArray: (thing: any) => boolean; isEmptyObject: (thing: any) => boolean; isFalse: (thing: any) => boolean; isNAN: (thing: any) => boolean; isNotArray: (thing: any) => boolean; isNotDefined: (thing: any) => boolean; isNotEmpty: (thing: any) => boolean; isNotEmptyArray: (thing: any) => boolean; isNotEmptyObject: (thing: any) => boolean; isNotObject: (thing: any) => boolean; isNotUniqueObject: (thing: any) => boolean; isObject: (thing: any) => boolean; isTrue: (thing: any) => boolean; isUniqueObject: (thing: any) => boolean }

Type declaration

  • assertIsDefined: (toAssertName: string, thing: any) => void
      • (toAssertName: string, thing: any): void
      • Throws an error if the object is not defined (see {@link #isNotDefined} method for definition).

        Parameters

        • toAssertName: string

          The name associated with the object. This name is used when the error is thrown.

        • thing: any

          The thing to assert against

        Returns void

  • assertIsEmpty: (toAssertName: string, thing: any) => void
      • (toAssertName: string, thing: any): void
      • Throws an error if the object is not empty (see {@link #isNotEmpty} method for definition).

        Parameters

        • toAssertName: string

          The name associated with the object. This name is used when the error is thrown.

        • thing: any

          The thing to assert against

        Returns void

  • assertIsNotDefined: (toAssertName: string, thing: any) => void
      • (toAssertName: string, thing: any): void
      • Throws an error if the object is defined (see {@link #isDefined} method for definition).

        Parameters

        • toAssertName: string

          The name associated with the object. This name is used when the error is thrown.

        • thing: any

          The thing to assert against

        Returns void

  • assertIsNotEmpty: (toAssertName: string, thing: any) => void
      • (toAssertName: string, thing: any): void
      • Throws an error if the object is empty (see {@link #isEmpty} method for definition).

        Parameters

        • toAssertName: string

          The name associated with the object. This name is used when the error is thrown.

        • thing: any

          The thing to assert against

        Returns void

  • isArray: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is an array or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if array; otherwise, false

  • isDefined: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is defined; otherwise, returns false.

        Returns false for the following:

        • typeof undefined
        • null
        • NaN

        Returns true for the following:

        • 0
        • false
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)
        • anything else

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if defined; false if not defined

  • isEmpty: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is empty; otherwise, returns false.

        Returns true for the following:

        • typeof undefined
        • null
        • NaN
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)

        Returns false for the following:

        • 0
        • false
        • anything else

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if empty; false if not empty

  • isEmptyArray: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is an empty array or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if empty array; otherwise, false

  • isEmptyObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is an empty object or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if empty object; otherwise, false

  • isFalse: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is false, "false", "f", or 0; otherwise, returns false.

        Returns false for the following:

        • typeof undefined
        • null
        • NaN
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)
        • true
        • 1
        • anything else
        • Returns true for the following:
        • false
        • "false"
        • "F"
        • 0

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if defined; false if not defined

  • isNAN: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is a NaN or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if NaN; otherwise, false

  • isNotArray: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is not an array or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if not array; otherwise, false

  • isNotDefined: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is not defined; otherwise, returns false.

        Returns true for the following:

        • typeof undefined
        • null
        • NaN

        Returns false for the following:

        • 0
        • false
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)
        • anything else

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if not defined; false if defined

  • isNotEmpty: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is not empty; otherwise, returns false.

        Returns false for the following:

        • typeof undefined
        • null
        • NaN
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)

        Returns true for the following:

        • 0
        • false
        • anything else

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if not empty; false if empty

  • isNotEmptyArray: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is a populated array or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if populated array; otherwise, false

  • isNotEmptyObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is a populated object or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if populated object; otherwise, false

  • isNotObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is not an Object or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if not Object; otherwise, false

  • isNotUniqueObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is not an unique object (like Date or File) or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if not unique object; otherwise, false

  • isObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is an Object or not. Note returns false on new Date() and new Error().

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if Object; otherwise, false

  • isTrue: (thing: any) => boolean
      • (thing: any): boolean
      • Returns true if the value is true, "true", "T", or 1; otherwise, returns false.

        Returns false for the following:

        • typeof undefined
        • null
        • NaN
        • 0
        • false
        • '' (empty string)
        • {} (empty object)
        • [] (empty array)
        • anything else

        Returns true for the following:

        • true
        • "true"
        • "T"
        • 1

        Parameters

        • thing: any

          thing to check

        Returns boolean

        true if defined; false if not defined

  • isUniqueObject: (thing: any) => boolean
      • (thing: any): boolean
      • Determines if the object is an unique object (like Date or File) or not

        Parameters

        • thing: any

          thing to be checked

        Returns boolean

        true if unique object; otherwise, false

Functions

Const assertIsDefined

  • assertIsDefined(toAssertName: string, thing: any): void
  • Throws an error if the object is not defined (see {@link #isNotDefined} method for definition).

    Parameters

    • toAssertName: string

      The name associated with the object. This name is used when the error is thrown.

    • thing: any

      The thing to assert against

    Returns void

Const assertIsEmpty

  • assertIsEmpty(toAssertName: string, thing: any): void
  • Throws an error if the object is not empty (see {@link #isNotEmpty} method for definition).

    Parameters

    • toAssertName: string

      The name associated with the object. This name is used when the error is thrown.

    • thing: any

      The thing to assert against

    Returns void

Const assertIsNotDefined

  • assertIsNotDefined(toAssertName: string, thing: any): void
  • Throws an error if the object is defined (see {@link #isDefined} method for definition).

    Parameters

    • toAssertName: string

      The name associated with the object. This name is used when the error is thrown.

    • thing: any

      The thing to assert against

    Returns void

Const assertIsNotEmpty

  • assertIsNotEmpty(toAssertName: string, thing: any): void
  • Throws an error if the object is empty (see {@link #isEmpty} method for definition).

    Parameters

    • toAssertName: string

      The name associated with the object. This name is used when the error is thrown.

    • thing: any

      The thing to assert against

    Returns void

Const isArray

  • isArray(thing: any): boolean
  • Determines if the object is an array or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if array; otherwise, false

Const isDefined

  • isDefined(thing: any): boolean
  • Returns true if the value is defined; otherwise, returns false.

    Returns false for the following:

    • typeof undefined
    • null
    • NaN

    Returns true for the following:

    • 0
    • false
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)
    • anything else

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if defined; false if not defined

Const isEmpty

  • isEmpty(thing: any): boolean
  • Returns true if the value is empty; otherwise, returns false.

    Returns true for the following:

    • typeof undefined
    • null
    • NaN
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)

    Returns false for the following:

    • 0
    • false
    • anything else

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if empty; false if not empty

Const isEmptyArray

  • isEmptyArray(thing: any): boolean
  • Determines if the object is an empty array or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if empty array; otherwise, false

Const isEmptyObject

  • isEmptyObject(thing: any): boolean
  • Determines if the object is an empty object or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if empty object; otherwise, false

Const isFalse

  • isFalse(thing: any): boolean
  • Returns true if the value is false, "false", "f", or 0; otherwise, returns false.

    Returns false for the following:

    • typeof undefined
    • null
    • NaN
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)
    • true
    • 1
    • anything else
    • Returns true for the following:
    • false
    • "false"
    • "F"
    • 0

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if defined; false if not defined

Const isNAN

  • isNAN(thing: any): boolean
  • Determines if the object is a NaN or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if NaN; otherwise, false

Const isNotArray

  • isNotArray(thing: any): boolean
  • Determines if the object is not an array or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if not array; otherwise, false

Const isNotDefined

  • isNotDefined(thing: any): boolean
  • Returns true if the value is not defined; otherwise, returns false.

    Returns true for the following:

    • typeof undefined
    • null
    • NaN

    Returns false for the following:

    • 0
    • false
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)
    • anything else

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if not defined; false if defined

Const isNotEmpty

  • isNotEmpty(thing: any): boolean
  • Returns true if the value is not empty; otherwise, returns false.

    Returns false for the following:

    • typeof undefined
    • null
    • NaN
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)

    Returns true for the following:

    • 0
    • false
    • anything else

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if not empty; false if empty

Const isNotEmptyArray

  • isNotEmptyArray(thing: any): boolean
  • Determines if the object is a populated array or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if populated array; otherwise, false

Const isNotEmptyObject

  • isNotEmptyObject(thing: any): boolean
  • Determines if the object is a populated object or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if populated object; otherwise, false

Const isNotObject

  • isNotObject(thing: any): boolean
  • Determines if the object is not an Object or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if not Object; otherwise, false

Const isNotUniqueObject

  • isNotUniqueObject(thing: any): boolean
  • Determines if the object is not an unique object (like Date or File) or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if not unique object; otherwise, false

Const isObject

  • isObject(thing: any): boolean
  • Determines if the object is an Object or not. Note returns false on new Date() and new Error().

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if Object; otherwise, false

Const isTrue

  • isTrue(thing: any): boolean
  • Returns true if the value is true, "true", "T", or 1; otherwise, returns false.

    Returns false for the following:

    • typeof undefined
    • null
    • NaN
    • 0
    • false
    • '' (empty string)
    • {} (empty object)
    • [] (empty array)
    • anything else

    Returns true for the following:

    • true
    • "true"
    • "T"
    • 1

    Parameters

    • thing: any

      thing to check

    Returns boolean

    true if defined; false if not defined

Const isUniqueObject

  • isUniqueObject(thing: any): boolean
  • Determines if the object is an unique object (like Date or File) or not

    Parameters

    • thing: any

      thing to be checked

    Returns boolean

    true if unique object; otherwise, false

Generated using TypeDoc