@pengzhanbo/utils - v3.4.1
    Preparing search index...

    Function notNullish

    • guard function that returns if val is not null or undefined

      守卫函数,返回 val 不为 null 或 undefined

      Type Parameters

      • T

      Parameters

      • val: T | null | undefined

        The value to check. 要检查的值

      Returns val is NonNullable<T>

      True if the value is not null or undefined, false otherwise. 如果值不是null或undefined则返回true,否则返回false

      [1, '', false, null, undefined].filter(notNullish) // => [1, '', false]