isTruthy | WebHare Platform SDK
WebHare Platform SDK
    Preparing search index...

    Function isTruthy

    • Returns (and TypeScript-asserts) that the specified function is truthy. Handy for adjusting the type of an array when filtering out falsy values

      Type Parameters

      • T

      Parameters

      Returns a is T & {}

      const myarray: Array<number | null> = [0, null];
      const filtered: number[] = myarray.filter(isTruthy);