forked from MapComplete/MapComplete
Scripts: more fixes to the uploadPanoramaxScript
This commit is contained in:
parent
664ddc686c
commit
6e335c91d4
5 changed files with 275 additions and 93 deletions
13
src/Utils.ts
13
src/Utils.ts
|
@ -1291,6 +1291,19 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
return newD
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* {"a": "b", "c":"d"} // => {"b":"a", "d":"c"}
|
||||
*/
|
||||
public static transposeMapSimple<K extends string, V extends string>(d: Record<K, V>): Record<V, K>{
|
||||
const inv = <Record<V, K>> {}
|
||||
for (const k in d) {
|
||||
const v = d[k]
|
||||
inv[v] = k
|
||||
}
|
||||
return inv
|
||||
}
|
||||
|
||||
/**
|
||||
* Utils.colorAsHex({r: 255, g: 128, b: 0}) // => "#ff8000"
|
||||
* Utils.colorAsHex(undefined) // => undefined
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue