forked from MapComplete/MapComplete
Chore: housekeeping, linting
This commit is contained in:
parent
f942529755
commit
30d00eb06d
74 changed files with 998 additions and 623 deletions
|
|
@ -178,7 +178,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
public static NoNull(array: undefined): undefined
|
||||
public static NoNull<T>(array: ReadonlyArray<T>): T[]
|
||||
public static NoNull<T>(array: ReadonlyArray<T>): NonNullable<T>[] {
|
||||
return <NonNullable<T>[]><unknown>array?.filter((o) => o !== undefined && o !== null)
|
||||
return <NonNullable<T>[]>(<unknown>array?.filter((o) => o !== undefined && o !== null))
|
||||
}
|
||||
|
||||
public static Hist(array: ReadonlyArray<string>): Map<string, number> {
|
||||
|
|
@ -332,7 +332,10 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
* @param toKey
|
||||
* @constructor
|
||||
*/
|
||||
public static DedupOnId<T = { id: string }>(arr: T[], toKey?: (t: T) => string | string[]): T[] {
|
||||
public static DedupOnId<T = { id: string }>(
|
||||
arr: T[],
|
||||
toKey?: (t: T) => string | string[]
|
||||
): T[] {
|
||||
const uniq: T[] = []
|
||||
const seen = new Set<string>()
|
||||
if (toKey === undefined) {
|
||||
|
|
@ -350,7 +353,7 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
}
|
||||
} else {
|
||||
const ksNoNull = Utils.NoNull(ks)
|
||||
const hasBeenSeen = ksNoNull.some(k => seen.has(k))
|
||||
const hasBeenSeen = ksNoNull.some((k) => seen.has(k))
|
||||
if (!hasBeenSeen) {
|
||||
uniq.push(img)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue