Hex Core JS
    Preparing search index...

    Function minOfKey

    • Finds the minimum value of a key in an array of objects. The given key must map to a number.

      Type Parameters

      • T extends Record<any, any>

      Parameters

      • array: T[]

        Array of objects to check.

      • key: KeyWithValueType<T, number>

        The key to check for values.

      Returns number | undefined

      const data = [
      { x: -1, y: 100 },
      { x: 100, y: -1 },
      ];

      minOfKey(data, "y") === -1