Skip to content

Instantly share code, notes, and snippets.

@hopewise
Created December 12, 2017 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hopewise/0373922e51e313a55390114908c31257 to your computer and use it in GitHub Desktop.
Save hopewise/0373922e51e313a55390114908c31257 to your computer and use it in GitHub Desktop.
Convert a key => value map into a sorted list based on values, works with value if string
Enum.map(Enum.to_list(0..Enum.count(Map.keys(row))), fn index -> row["#{index}"] end)
example row:
row %{"0" => "2", "1" => "أحمد عمر فؤاد خالد عبدالله 2",
"10" => "null", "11" => "null", "12" => "null", "13" => "null",
"14" => "null", "2" => "Male", "3" => "الأول الأساسي", "4" => "A",
"5" => "Amman", "6" => "null", "7" => "null", "8" => "null", "9" => "null"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment