UNPKG

@humanspeak/svelte-headless-table

Version:

A powerful, headless table library for Svelte that provides complete control over table UI while handling complex data operations like sorting, filtering, pagination, grouping, and row expansion. Build custom, accessible data tables with zero styling opin

18 lines (17 loc) 495 B
export const compare = (a, b) => { if (Array.isArray(a) && Array.isArray(b)) { return compareArray(a, b); } if (typeof a === 'number' && typeof b === 'number') return a - b; return a < b ? -1 : a > b ? 1 : 0; }; export const compareArray = (a, b) => { const minLength = Math.min(a.length, b.length); for (let i = 0; i < minLength; i++) { const order = compare(a[i], b[i]); if (order !== 0) return order; } return 0; };