Library API
    Preparing search index...

    Function extract

    • Gets a nested value from an object using dot or bracket notation.

      Type Parameters

      • T

      Parameters

      • obj: any

        The object to extract the value from

      • path: string | number

        The path to the value using dot or bracket notation

      • Optionaldflt: T

        The default value to return if the path does not exist

      Returns T

      The extracted value or the default value

      const val = extract(user, 'profile.address.zip', '00000');