Scripts: reorder tagRenderings, fix tests

This commit is contained in:
Pieter Vander Vennet 2025-07-11 20:15:32 +02:00
parent bba8546a55
commit 2e66278291
5 changed files with 50 additions and 9 deletions

View file

@ -1882,7 +1882,15 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
return [].concat(...param)
}
/**
*
* JSON.stringify(Utils.reorder({b: "0", a: "1"}, ["a", "b"])) // => '{"a":"1","b":"0"}'
* Utils.reorder("test", []) // => "test"
*/
public static reorder<T extends object>(object: T, order: ReadonlyArray<string>): T {
if(typeof object !== "object"){
return object
}
const allKeys = new Set<string>(Object.keys(object))
const copy = {}
for (const key of order) {