Initial commit: Aeroflot Flights Web Angular 12 application

This commit is contained in:
2026-04-03 10:10:52 +03:00
commit 2342f2e66e
1311 changed files with 128350 additions and 0 deletions
@@ -0,0 +1,34 @@
export type Group<T, TK> = { key: TK; items: T[] };
declare global {
interface Array<T> {
groupBy<T, TK>(keyFn: (item: T) => TK): Group<T, TK>[];
intersect<T>(other: T[]): T[];
}
}
if (!Array.prototype.groupBy)
Array.prototype.intersect = function <T>(this: T[], other: T[]): T[] {
const set = new Set<T>(this);
return other.filter((i) => set.has(i));
};
if (!Array.prototype.groupBy)
Array.prototype.groupBy = function <T, TK>(
this: T[],
keyFn: (item: T) => TK,
): Group<T, TK>[] {
const hash = new Map<TK, Group<T, TK>>();
this.forEach((item) => {
const key = keyFn(item);
let group = hash.get(key);
if (!group) {
group = { key, items: [] };
hash.set(key, group);
}
group.items.push(item);
});
return [...hash.values()];
};
export default {};
+33
View File
@@ -0,0 +1,33 @@
/**
* Copied from https://github.com/behnammodi/polyfill/blob/master/string.polyfill.js
*
* String.padStart()
* version 1.0.1
* Feature Chrome Firefox Internet Explorer Opera Safari Edge
* Basic support 57 51 (No) 44 10 15
* -------------------------------------------------------------------------------
*/
if (!String.prototype.padStart) {
Object.defineProperty(String.prototype, 'padStart', {
configurable: true,
writable: true,
value: function (targetLength, padString) {
targetLength = targetLength >> 0; //floor if number or convert non-number to 0;
padString = String(
typeof padString !== 'undefined' ? padString : ' ',
);
if (this.length > targetLength) {
return String(this);
} else {
targetLength = targetLength - this.length;
if (targetLength > padString.length) {
padString += padString.repeat(
targetLength / padString.length,
); //append to original to ensure we are longer than needed
}
return padString.slice(0, targetLength) + String(this);
}
},
});
}