Codibre/fluent-iterable

View on GitHub
src/recipes/sort-recipe.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { Comparer } from '../types/base';
import { BasicIngredients } from './ingredients';

export function sortRecipe({ toArray, resolver, iterate }: BasicIngredients) {
  return function <T>(this: Iterable<T>, comparer?: Comparer<T>) {
    return iterate(resolver(toArray.call(this), (b) => b.sort(comparer)));
  };
}