@ryandur/sand
    Preparing search index...

    Variable hasConst

    has: <T>(value: T | null | undefined) => value is T = notEmpty

    A value that is not empty.

    Type Declaration

      • <T>(value: T | null | undefined): value is T
      • A value that is not empty.

        Type Parameters

        • T

        Parameters

        • value: T | null | undefined

        Returns value is T

        test for has

        Example:

        notEmpty({}) // produces: false
        notEmpty({I: 'am not empty'}) // produces: true

        notEmpty([]) // produces: false
        notEmpty([1, 2, 3]) // produces: true

        notEmpty('') // produces: false
        notEmpty('not empty') // produces: true

        notEmpty(NaN) // produces: false
        notEmpty(0) // produces: true

        A false result does not prove absence: '' and [] and {} are present but empty, yet the negative branch narrows as though the value were null or undefined. Guard with has/notEmpty when you want substance; compare against undefined when you only care about presence.

    test for has

    Example:

    has({}) // produces: false
    has({I: 'am not empty'}) // produces: true

    has([]) // produces: false
    has([1, 2, 3]) // produces: true

    has('') // produces: false
    has('not empty') // produces: true

    has(NaN) // produces: false
    has(0) // produces: true