Options
All
  • Public
  • Public/Protected
  • All
Menu

External module "is-truthy"

Index

Functions

Functions

isTruthy

  • isTruthy(value: any): boolean

  • Example usage:

    import { isTruthy } from "@thalesrc/js-utils";
    
    isTruthy(undefined); // false
    isTruthy(true); // true
    isTruthy([]) // true
    
    const truthyValues = ["a", undefined, "b", "", "c"].filter(isTruthy); // ["a", "b", "c"]

    Static usage example:

    import "@thalesrc/js-utils/dist/as-static/is-truthy";
    
    Boolean.isTruthy(undefined); // false
    Boolean.isTruthy(true); // true
    Boolean.isTruthy([]) // true
    
    const truthyValues = ["a", undefined, "b", "", "c"].filter(Boolean.isTruthy); // ["a", "b", "c"]

    Parameters

    • value: any

      value to be checked

    Returns boolean

Generated using TypeDoc