MCPcopy Create free account
hub / github.com/effect-app/libs / sortBy

Function sortBy

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

Source from the content-addressed store, hash-verified

2165export const sortBy = <S extends Iterable<any>>(
2166 ...orders: ReadonlyArray<Order.Order<ReadonlyArray.Infer<S>>>
2167) => {
2168 const sortByAll = sort(Order.combineAll(orders))
2169 return (
2170 self: S
2171 ): S extends NonEmptyReadonlyArray<infer A> ? NonEmptyArray<A> : S extends Iterable<infer A> ? Array<A> : never => {
2172 const input = fromIterable(self)
2173 if (isReadonlyArrayNonEmpty(input)) {
2174 return sortByAll(input) as any
2175 }
2176 return [] as any
2177 }
2178}
2179
2180/**
2181 * Pairs elements from two iterables by position. If the iterables differ in
2182 * length, the extra elements from the longer one are discarded.
2183 *

Callers

nothing calls this directly

Calls 2

sortFunction · 0.85
fromIterableFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…