import { Dictionary } from './dictionary' import { Enumerable, IEnumerable } from './enumerable' import { IEqualityComparer } from './equality-comparer' import { IGrouping } from './grouping' import { List } from './list' Array.prototype.All = function (predicate: (item: T) => boolean): boolean { return Enumerable.All(this, predicate) } Array.prototype.Any = function (predicate?: (item: T) => boolean): boolean { return Enumerable.Any(this, predicate) } Array.prototype.AsEnumerable = function (): IEnumerable { return Enumerable.AsEnumerable(this) } Array.prototype.Average = function (selector?: (item: T) => number): number | null { return Enumerable.Average(this, selector) } Array.prototype.Concat = function (second: IEnumerable): IEnumerable { return Enumerable.Concat(this, second) } Array.prototype.Contains = function (value: T, comparer?: IEqualityComparer): boolean { return Enumerable.Contains(this, value, comparer) } Array.prototype.Count = function (predicate?: (item: T) => boolean): number { return Enumerable.Count(this, predicate) } Array.prototype.DefaultIfEmpty = function (defaultValue?: IEnumerable): IEnumerable { return Enumerable.DefaultIfEmpty(this, defaultValue) } Array.prototype.Distinct = function (comparer?: IEqualityComparer): IEnumerable { return Enumerable.Distinct(this, comparer) } Array.prototype.ElementAt = function (index: number): T { return Enumerable.ElementAt(this, index) } Array.prototype.ElementAtOrDefault = function (defaultValue: T, index: number): T { return Enumerable.ElementAtOrDefault(this, defaultValue, index) } Array.prototype.Except = function (second: IEnumerable, comparer?: IEqualityComparer): IEnumerable { return Enumerable.Except(this, second, comparer) } Array.prototype.First = function (predicate?: (item: T) => boolean): T { return Enumerable.First(this, predicate) } Array.prototype.FirstOrDefault = function (defaultValue: T, predicate?: (item: T) => boolean): T { return Enumerable.FirstOrDefault(this, defaultValue, predicate) } Array.prototype.GroupBy = function ( keySelector: (item: T) => TKey, elementSelector?: (item: T) => TElement, comparer?: IEqualityComparer ): IEnumerable> { return Enumerable.GroupBy(this, keySelector, elementSelector, comparer) } Array.prototype.GroupJoin = function }>( inner: IEnumerable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector?: (item: T, inners: IEnumerable) => TResult, comparer?: IEqualityComparer ): IEnumerable { return Enumerable.GroupJoin(this, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) } Array.prototype.Intersect = function (second: IEnumerable, comparer?: IEqualityComparer): IEnumerable { return Enumerable.Intersect(this, second, comparer) } Array.prototype.Join = function ( inner: IEnumerable, outerKeySelector: (item: T) => TKey, innerKeySelector: (item: TInner) => TKey, resultSelector?: (item: T, inners: TInner) => TResult, comparer?: IEqualityComparer ): IEnumerable { return Enumerable.Join(this, inner, outerKeySelector, innerKeySelector, resultSelector, comparer) } Array.prototype.Last = function (predicate?: (item: T) => boolean): T { return Enumerable.Last(this, predicate) } Array.prototype.LastOrDefault = function (defaultValue: T, predicate?: (item: T) => boolean): T { return Enumerable.LastOrDefault(this, defaultValue, predicate) } Array.prototype.Max = function (selector?: (item: T) => number): number | null { return Enumerable.Max(this, selector) } Array.prototype.Min = function (selector?: (item: T) => number): number | null { return Enumerable.Min(this, selector) } Array.prototype.Reverse = function (): IEnumerable { return Enumerable.Reverse(this) } Array.prototype.Select = function (selector: (item: T, index?: number) => TResult): IEnumerable { return Enumerable.Select(this, selector) } Array.prototype.SelectMany = function ( collectionSelector: (item: T, index?: number) => IEnumerable, resultSelector?: (item: T, collection: TCollection) => TResult ): IEnumerable { return Enumerable.SelectMany(this, collectionSelector, resultSelector) } Array.prototype.SequenceEqual = function (second: Iterable, comparer?: IEqualityComparer): boolean { return Enumerable.SequenceEqual(this, second, comparer) } Array.prototype.Single = function (predicate?: (item: T) => boolean): T { return Enumerable.Single(this, predicate) } Array.prototype.SingleOrDefault = function (defaultValue: T, predicate?: (item: T) => boolean): T { return Enumerable.SingleOrDefault(this, defaultValue, predicate) } Array.prototype.Skip = function (count: number): IEnumerable { return Enumerable.Skip(this, count) } Array.prototype.SkipWhile = function (predicate: (item: T, index?: number) => boolean): IEnumerable { return Enumerable.SkipWhile(this, predicate) } Array.prototype.Sum = function (selector?: (item: T) => number): number | null { return Enumerable.Sum(this, selector) } Array.prototype.Take = function (count: number): IEnumerable { return Enumerable.Take(this, count) } Array.prototype.TakeWhile = function (predicate: (item: T, index?: number) => boolean): IEnumerable { return Enumerable.TakeWhile(this, predicate) } Array.prototype.ToArray = function (): Array { return Enumerable.ToArray(this) } Array.prototype.ToDictionary = function ( keySelector: (item: T) => TKey, elementSelector?: (item: T) => TElement, comparer?: IEqualityComparer ): Dictionary { return Enumerable.ToDictionary(this, keySelector, elementSelector, comparer) } Array.prototype.ToList = function (): List { return Enumerable.ToList(this) } Array.prototype.Union = function (second: Iterable, comparer?: IEqualityComparer): IEnumerable { return Enumerable.Union(this, second, comparer) } Array.prototype.Where = function (predicate: (item: T, index?: number) => boolean): IEnumerable { return Enumerable.Where(this, predicate) }