forked from MapComplete/MapComplete
Improve error reporting, first attempt for script which handles the errors
This commit is contained in:
parent
b4ffdbd942
commit
4ef3429c5a
6 changed files with 117 additions and 11 deletions
|
@ -1267,13 +1267,21 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
return track[str2.length][str1.length]
|
||||
}
|
||||
|
||||
public static MapToObj<V>(
|
||||
d: Map<string, V>
|
||||
): Record<string, V>;
|
||||
public static MapToObj<V, T>(
|
||||
d: Map<string, V>,
|
||||
onValue: (t: V, key: string) => T
|
||||
): Record<string, T>
|
||||
public static MapToObj<V, T>(
|
||||
d: Map<string, V>,
|
||||
onValue: (t: V, key: string) => T = undefined
|
||||
): Record<string, T> {
|
||||
const o = {}
|
||||
const keys = Array.from(d.keys())
|
||||
keys.sort()
|
||||
onValue ??= (v => <any> v)
|
||||
for (const key of keys) {
|
||||
o[key] = onValue(d.get(key), key)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue