Options
All
  • Public
  • Public/Protected
  • All
Menu

Module defaultTo

Index

References

Functions Util

References

Renames and re-exports defaultTo

Util Functions

  • defaultTo<T>(value: any, defaultValue: T): T
  • Checks value to determine whether a default value should be returned in its place. The defaultValue is returned if value is NaN, null, or undefined.

    since

    5.12.0

    example
    defaultTo(1, 10)
    // => 1

    defaultTo(undefined, 10)
    // => 10

    Type parameters

    • T

    Parameters

    • value: any

      The value to check.

    • defaultValue: T

      The default value.

    Returns T

    Returns the resolved value.