compare
Compare module - Comparator builders for sorting and ordering.
Provides composable comparators for sorting arrays of complex objects with type-safe, reusable comparison logic.
Example
import { ascending, compose, byDate } from 'receta/compare'
interface Issue {
status: string
priority: number
createdAt: Date
}
// Multi-level sorting
issues.sort(
compose(
ascending(i => i.status),
ascending(i => i.priority),
byDate(i => i.createdAt)
)
)
References
ascending
Re-exports ascending
byBoolean
Re-exports byBoolean
byDate
Re-exports byDate
byKey
Re-exports byKey
byNumber
Re-exports byNumber
byString
Re-exports byString
caseInsensitive
Re-exports caseInsensitive
ComparableExtractor
Re-exports ComparableExtractor
Comparator
Re-exports Comparator
compose
Re-exports compose
descending
Re-exports descending
localeCompare
Re-exports localeCompare
natural
Re-exports natural
Nullable
Re-exports Nullable
nullsFirst
Re-exports nullsFirst
nullsLast
Re-exports nullsLast
reverse
Re-exports reverse
StringCompareOptions
Re-exports StringCompareOptions
withTiebreaker
Re-exports withTiebreaker