import { IterableActivity , Source , isSource } from "./activity" ; export type SortCallback < T > = ( a : T , b : T ) => number ; function sortGen < T = any > ( compareFn ? ) { return function * ( source ) { yield * ( Array . isArray ( source ) ? source : [ ... source ] ) . sort ( compareFn ) ; } ; } export function sort < T = any > ( callbackFn ) ; export function sort < T = any > ( source , callbackFn ) ; export function sort < T = any > ( s_or_cb , callbackFn ? ) { return isSource ( s_or_cb ) ? sortGen ( callbackFn ! ) ( s_or_cb ) : sortGen ( s_or_cb ) ; }