forked from MapComplete/MapComplete
Add tests
This commit is contained in:
parent
309ddb8d13
commit
bd1ec96dd0
1 changed files with 9 additions and 1 deletions
|
@ -367,7 +367,7 @@ function transformTranslation(
|
||||||
return `new Translation( ${JSON.stringify(obj)} )`
|
return `new Translation( ${JSON.stringify(obj)} )`
|
||||||
}
|
}
|
||||||
|
|
||||||
let values: string[] = []
|
const values: string[] = []
|
||||||
const spaces = Utils.Times((_) => " ", path.length + 1)
|
const spaces = Utils.Times((_) => " ", path.length + 1)
|
||||||
|
|
||||||
for (const key in obj) {
|
for (const key in obj) {
|
||||||
|
@ -424,6 +424,14 @@ function transformTranslation(
|
||||||
return `{${values.join(",\n")}}`
|
return `{${values.join(",\n")}}`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* const result = sortKeys({"b": 43, "a": 42})
|
||||||
|
* JSON.stringify(result) // => '{"a":42,"b":43}'
|
||||||
|
*
|
||||||
|
* const result = sortKeys({"1": "one", "2": "two", "9":"nine","10": "ten"})
|
||||||
|
* JSON.stringify(result) // => '{"1":"one","10":"ten","2":"two","9":"nine"}'
|
||||||
|
*/
|
||||||
function sortKeys(o: object): object {
|
function sortKeys(o: object): object {
|
||||||
const keys = Object.keys(o)
|
const keys = Object.keys(o)
|
||||||
keys.sort()
|
keys.sort()
|
||||||
|
|
Loading…
Add table
Reference in a new issue