Add several more util functions and tests (#4106)

This commit is contained in:
Sebastian Malton authored and GitHub committed 2021-10-26 09:36:34 -04:00
1 parent 0aabc9a5de
commit 5abc1c618c
9 files changed
+132 -31

No files matched your search

+2 -2
View File
@@ -20,7 +20,7 @@
*/
import type { TableSortCallback } from "./table";
import { array, Ordering, rectifyOrdering, sortCompare } from "../../utils";
import { Ordering, rectifyOrdering, sortCompare, tuple } from "../../utils";
export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T> | undefined, orderByRaw: string): T[] {
if (typeof sortingCallback !== "function") {
@@ -40,7 +40,7 @@ export function getSorted<T>(rawItems: T[], sortingCallback: TableSortCallback<T
const leftSortBy = [left.sortBy].flat();
const rightSortBy = [right.sortBy].flat();
const zipIter = array.zipStrict(leftSortBy, rightSortBy);
const zipIter = tuple.zip(leftSortBy, rightSortBy);
let r = zipIter.next();
for (; r.done === false; r = zipIter.next()) {