Options
All
  • Public
  • Public/Protected
  • All
Menu

Module Util

This module contains various utility methods for checking values. They can be used to test equality or validity of data, such as if a value is exactly true, or if it is an empty string (and not just null).

Many of the methods in this module are trivial. The intent is to provide explicit checks for values, since type coercion in JavaScript can at times cause equality checks to be maddeningly non-apparent and inconsistent (see dotJS 2012 - Brian Leroux - WTFJS.)

Index

Functions

isEmptyString

  • isEmptyString(a: any): boolean
  • Returns true if the input is a string (literal or String instance) containing 0 characters. Returns false for all other values.

    Parameters

    • a: any

    Returns boolean

isFalse

  • isFalse(a: any): boolean
  • Returns true if the input value is exactly false. Returns false for all other values, including "falsy" ones.

    Parameters

    • a: any

    Returns boolean

isIterable

  • isIterable(a: any): boolean
  • Parameters

    • a: any

    Returns boolean

isNonEmptyString

  • isNonEmptyString(a: any): boolean
  • Returns true if the input is a string (literal or String instance) containing one or more characters. Returns false for all other values.

    Parameters

    • a: any

    Returns boolean

isTrue

  • isTrue(a: any): boolean
  • Returns true if the input is exactly true. Returns false for all other values, even "truthy" ones.

    Parameters

    • a: any

    Returns boolean

notFalse

  • notFalse(a: any): boolean
  • Returns false if the input value is exactly false. Returns true for all other values, including "falsy" ones.

    Parameters

    • a: any

    Returns boolean

notFalsy

  • notFalsy(a: any): boolean
  • Returns true if the input value is not considered a "falsy" value.

    Parameters

    • a: any

    Returns boolean

notNull

  • notNull(a: any): boolean
  • Returns false if the input value is exactly null. Returns true for all other values, including undefined.

    Parameters

    • a: any

    Returns boolean

notTrue

  • notTrue(a: any): boolean
  • Returns false if the input value is exactly true. Returns true for all other values, including "truthy" ones.

    Parameters

    • a: any

    Returns boolean

notTruthy

  • notTruthy(a: any): boolean
  • Returns true if the input value is not considered a "truthy" value.

    Parameters

    • a: any

    Returns boolean

Made by Horyus. Documentation generated by TypeDoc.