dist/iterable/operators.js
/** Play the given Iterable ordered by a given key or itself */
Play the given Iterable ordered by a given key or itself
Play the given Iterable ordered by a given key or itself
function orderBy(keySelector, comparison) {
    const trueKeySelector = keySelector || defaultKeySelector;
    const trueComparison = comparison || defaultComparison;
    return function* (item) {
        const keyedMapper = map((item, index) => ({ item, key: trueKeySelector(item, index) }));
        const keyed = keyedMapper(item);
        const keyedArray = Array.from(keyed);
        keyedArray.sort((a, b) => trueComparison(a.key, b.key));
        for (const { item } of keyedArray) {
            yield item;
        }
    };
}
function orderBy ( keySelector , comparison ) { const trueKeySelector = keySelector || defaultKeySelector ; const trueComparison = comparison || defaultComparison ; return function * ( item ) { const keyedMapper = map ( ( item , index ) => ( { item , key : trueKeySelector ( item , index ) } ) ) ; const keyed = keyedMapper ( item ) ; const keyedArray = Array . from ( keyed ) ; keyedArray . sort ( ( a , b ) => trueComparison ( a . key , b . key ) ) ; for ( const { item } of keyedArray ) { yield item ; } } ; }
Play the given Iterable ordered by a given key or itself
Play the given Iterable ordered by a given key or itself