0

I am trying to sort the keys of an JSON Object in TypeScript which are keys with versions in SemVer format.

Object example:

{
  "changelog": {
     "1.0.0": "Changes...",
     "1.0.1": "More changes..."
  }
}

Is there a efficient and low amount of code approach for this?

(Note: This didn't really help me, as I'm looking to do SemVer-only sorting.

nikoszz
  • 163
  • 1
  • 3
  • 13
  • Nothing will help you, objects simply don't keep up an order of the properties, the order you get is created by the iteration methods. The only way is to create a clever data object with its own iteration method. – Teemu Jan 25 '23 at 08:04

0 Answers0