(json, order)
| 12 | } |
| 13 | |
| 14 | function sortJsonArray(json, order) { |
| 15 | if (order === undefined) { |
| 16 | return json; |
| 17 | } |
| 18 | if (order === "alpha") { |
| 19 | return [...json].sort(); |
| 20 | } |
| 21 | throw new TypeError(`Invalid array order [${order}]`); |
| 22 | } |
| 23 | |
| 24 | function sortJsonObject(json, order) { |
| 25 | if (order === undefined) { |