MCPcopy Index your code
hub / github.com/Effect-TS/effect / sortBy

Function sortBy

packages/effect/src/Array.ts:1534–1547  ·  view source on GitHub ↗
(
  ...orders: ReadonlyArray<Order.Order<ReadonlyArray.Infer<S>>>
)

Source from the content-addressed store, hash-verified

1532 * @since 2.0.0
1533 */
1534export const sortBy = <S extends Iterable<any>>(
1535 ...orders: ReadonlyArray<Order.Order<ReadonlyArray.Infer<S>>>
1536) => {
1537 const sortByAll = sort(Order.combineAll(orders))
1538 return (
1539 self: S
1540 ): S extends NonEmptyReadonlyArray<infer A> ? NonEmptyArray<A> : S extends Iterable<infer A> ? Array<A> : never => {
1541 const input = fromIterable(self)
1542 if (isNonEmptyReadonlyArray(input)) {
1543 return sortByAll(input) as any
1544 }
1545 return [] as any
1546 }
1547}
1548
1549/**
1550 * Takes two `Iterable`s and returns an `Array` of corresponding pairs.

Callers

nothing calls this directly

Calls 1

fromIterableFunction · 0.70

Tested by

no test coverage detected