Libraries v5.2.0
    Preparing search index...

    Function deepSort

    • Stably sort records in place by one numeric position in an array-valued field.

      Input must be a dense array of records; missing entries reject before mutation. All keys are validated before changing the input. An invalid index rejects with RangeError; missing/non-array fields and non-finite keys reject with TypeError. Empty input is valid. Equal keys retain their original order.

      Type Parameters

      • T extends object

      Parameters

      • items: T[]
      • index: number
      • field: keyof T

      Returns T[]

      deepSort([{ path: [2, 0] }, { path: [1, 4] }], 0, 'path');
      // => [{ path: [1, 4] }, { path: [2, 0] }]