forked from MapComplete/MapComplete
First steps to a real testing framework: first working version with mocha, chai and doctest-ts
This commit is contained in:
parent
edc366149b
commit
4f4fc650b1
42 changed files with 9032 additions and 9275 deletions
6
Utils.ts
6
Utils.ts
|
@ -657,6 +657,12 @@ In the case that MapComplete is pointed to the testing grounds, the edit will be
|
|||
return bestColor ?? hex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Reorders an object: creates a new object where the keys have been added alphabetically
|
||||
*
|
||||
* const sorted = Utils.sortKeys({ x: 'x', abc: {'x': 'x', 'a': 'a'}, def: 'def'})
|
||||
* JSON.stringify(sorted) // => '{"abc":{"a":"a","x":"x"},"def":"def","x":"x"}'
|
||||
*/
|
||||
static sortKeys(o: any) {
|
||||
const copy = {}
|
||||
let keys = Object.keys(o)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue