Scripts: more fixes to the uploadPanoramaxScript

This commit is contained in:
Pieter Vander Vennet 2024-11-10 23:51:41 +01:00
parent 664ddc686c
commit 6e335c91d4
5 changed files with 275 additions and 93 deletions

View file

@ -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