import * as lib from './index'; import { ItemPredicate, LeftRightPredicate, Projector, ProjectMany } from './types'; declare global { interface Array { qAny(predicate?: ItemPredicate): boolean; qAll(predicate: ItemPredicate): boolean; qIncludes(value: T): boolean; qNone(predicate?: ItemPredicate): boolean; qCount(predicate?: ItemPredicate): number; qContains(right: TR[], comparer?: LeftRightPredicate): boolean; qIntersect(right: TR[], comparer?: LeftRightPredicate): T[]; qSame(right: TR[], comparer?: LeftRightPredicate): boolean; qEmpty(): boolean; qFirst(predicate?: ItemPredicate): T; qLast(predicate?: ItemPredicate): T; qRotate(offset: number): T[]; qMapMany(selector?: ProjectMany): TR[]; qSelect(selector: Projector): TOut[]; qDistinct(key?: Projector): T[]; qWhere(predicate: ItemPredicate): T[]; } } import { UAParser } from 'ua-parser-js'; const engine: string = new UAParser().getEngine().name; if (engine !== undefined && !/WebKit/i.test(engine)) { if (!Array.prototype.qMapMany) { Array.prototype.qMapMany = function(selector?: ProjectMany) { return lib.mapManyNative(this, selector); }; } if (!Array.prototype.qSelect) { Array.prototype.qSelect = Array.prototype.map; } } if (!Array.prototype.qContains) { Array.prototype.qContains = function(right: TR[], comparer?: LeftRightPredicate) { return lib.contains(this, right, comparer); }; } if (!Array.prototype.qIntersect) { Array.prototype.qIntersect = function(right: TR[], comparer?: LeftRightPredicate) { return lib.intersect(this, right, comparer); }; } if (!Array.prototype.qSame) { Array.prototype.qSame = function(right: TR[], comparer?: LeftRightPredicate) { return lib.same(this, right, comparer); }; } if (!Array.prototype.qEmpty) { Array.prototype.qEmpty = function() { return lib.empty(this); }; } if (!Array.prototype.qFirst) { Array.prototype.qFirst = function(predicate?: ItemPredicate) { return lib.first(this, predicate); }; } if (!Array.prototype.qLast) { Array.prototype.qLast = function(predicate?: ItemPredicate) { return lib.last(this, predicate); }; } if (!Array.prototype.qRotate) { Array.prototype.qRotate = function(offset: number) { return lib.rotate(this, offset); }; } if (!Array.prototype.qMapMany) { Array.prototype.qMapMany = function(selector?: ProjectMany) { return lib.mapMany(this, selector); }; } if (!Array.prototype.qDistinct) { Array.prototype.qDistinct = function(key?: Projector) { return lib.distinct(this, key); }; } if (!Array.prototype.qSelect) { Array.prototype.qSelect = function(predicate: Projector) { return lib.select(this, predicate); }; } if (!Array.prototype.qAny) { Array.prototype.qAny = function(predicate?: ItemPredicate) { return lib.any(this, predicate); }; } if (!Array.prototype.qAll) { Array.prototype.qAll = function(predicate: ItemPredicate) { return lib.all(this, predicate); }; } if (!Array.prototype.qIncludes) { Array.prototype.qIncludes = function(value: T) { return lib.includes(this, value); }; } if (!Array.prototype.qNone) { Array.prototype.qNone = function(predicate?: ItemPredicate) { return lib.none(this, predicate); }; } if (!Array.prototype.qCount) { Array.prototype.qCount = function(predicate?: ItemPredicate) { return lib.count(this, predicate); }; } if (!Array.prototype.qWhere) { Array.prototype.qWhere = function(predicate: ItemPredicate) { return lib.where(this, predicate); }; }