/** * Copyright 2024 Phenix Real Time Solutions, Inc. Confidential and Proprietary. All Rights Reserved. */ import {DirectionType} from 'interfaces/tableProps'; import {DataValueType} from 'components/table'; export const compare = (a: Record, b: Record, direction: DirectionType, propName: string): number => { if (a && b) { const isDesc = direction === DirectionType.Desc; if (a[propName] < b[propName]) { return isDesc ? -1 : 1; } else if (a[propName] > b[propName]) { return isDesc ? 1 : -1; } } return 0; };