Options
All
  • Public
  • Public/Protected
  • All
Menu

A collection of functions related to sorting objects within a parent container.

Hierarchy

  • SortingHelpers

Index

Constructors

Methods

  • performIntegerSort(source: any, [options]?: { target: any; siblings: any[]; sortKey: string; sortBefore: boolean }): any[]
  • Given a source object to sort, a target to sort relative to, and an Array of siblings in the container: Determine the updated sort keys for the source object, or all siblings if a reindex is required. Return an Array of updates to perform, it is up to the caller to dispatch these updates. Each update is structured as: { target: object, update: {sortKey: sortValue} }

    Parameters

    • source: any

      The source object being sorted

    • [options]: { target: any; siblings: any[]; sortKey: string; sortBefore: boolean } = {}

      Options which modify the sort behavior

      • target: any
      • siblings: any[]
      • sortKey: string
      • sortBefore: boolean

    Returns any[]

    An Array of updates for the caller of the helper function to perform

  • _sortBefore(siblings: any, idx: any, sortKey: any): any[]
  • Given an ordered Array of siblings and a target position, return the [min,max] indices to sort before the target

    Parameters

    • siblings: any
    • idx: any
    • sortKey: any

    Returns any[]

  • _sortAfter(siblings: any, idx: any, sortKey: any): any[]
  • Given an ordered Array of siblings and a target position, return the [min,max] indices to sort after the target

    Parameters

    • siblings: any
    • idx: any
    • sortKey: any

    Returns any[]