@veracity/vui
Version:
Veracity UI is a React component library crafted for use within Veracity applications and pages. Based on Styled Components and @xstyled.
10 lines (9 loc) • 518 B
TypeScript
import { Sort } from "./types.js";
//#region src/utils/array.d.ts
/** Comparator for Array.sort when sorting arrays of objects by given key with optional order. */
declare function compareBy<T extends object, K extends keyof T>(key: K, order?: Sort['order']): (item1: T, item2: T) => number;
/** Adds given item to the array if it wasn't there yet, or removes it otherwise. */
declare function toggleItem<T>(array: T[], item: T): T[];
//#endregion
export { compareBy, toggleItem };
//# sourceMappingURL=array.d.ts.map