forked from MapComplete/MapComplete
Stricter layer checking
This commit is contained in:
parent
18c53af27f
commit
3334e0d384
5 changed files with 42 additions and 258 deletions
15
Utils.ts
15
Utils.ts
|
@ -144,6 +144,21 @@ Note that these values can be prepare with javascript in the theme by using a [c
|
|||
return newArr;
|
||||
}
|
||||
|
||||
public static Dupicates(arr: string[]): string[] {
|
||||
if (arr === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
const newArr = [];
|
||||
const seen = new Set<string>();
|
||||
for (const string of arr) {
|
||||
if(seen.has(string)){
|
||||
newArr.push(string)
|
||||
}
|
||||
seen.add(string)
|
||||
}
|
||||
return newArr;
|
||||
}
|
||||
|
||||
public static Identical<T>(t1: T[], t2: T[], eq?: (t: T, t0: T) => boolean): boolean {
|
||||
if (t1.length !== t2.length) {
|
||||
return false
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue