forked from MapComplete/MapComplete
Scripts: reorder tagRenderings, fix tests
This commit is contained in:
parent
bba8546a55
commit
2e66278291
5 changed files with 50 additions and 9 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue