/** * 数组排序 * @param {func} Function * @param {sortDirection} key desc 降序 asc 升序 * @returns * * Example * ``` * const lowestFirst = myArr.SortByArg(x => x.score); * const lowestFirst = myArr.SortByArg(x => x.score, "asc"); * const highestFirst = myArr.SortByArg(x => x.score, "desc"); * ``` */ export {}; type SortDirection = "asc" | "desc"; declare global { interface Array { sortBy(func?: (value: T) => string | number, sortDirection?: SortDirection): T[]; } }