Options
All
  • Public
  • Public/Protected
  • All
Menu

Module src/object/findKeyAndValueByPriority

Index

Functions

Const findKeyAndValueByPriority

  • findKeyAndValueByPriority<T>(data: T, columnsByPriority: keyof T[], valueCheck: (value: T[keyof T]) => boolean): KeyAndValue<T, keyof T> | null
  • Finds the first key and value that meets a check in an object

    template

    extends keyof T

    Type parameters

    • T: object

      extends object

    Parameters

    • data: T

      Data to find the value

    • columnsByPriority: keyof T[]

      Array of keys in order of priority to search the data object

    • valueCheck: (value: T[keyof T]) => boolean

      Predicate function each value found by data[column]

        • (value: T[keyof T]): boolean
        • Parameters

          • value: T[keyof T]

          Returns boolean

    Returns KeyAndValue<T, keyof T> | null

    The key and value as JSON

Generated using TypeDoc