This repository has been archived on 2024-09-20. You can view files and clone it, but cannot push or open issues or pull requests.
musicapp/helpers.moon
2019-04-17 23:23:16 -07:00

18 lines
516 B
Plaintext

process_tags = (tags_str) ->
-- split into a table to garuntee uniqueness
unique = {}
for tag in tags_str\gmatch "%S+"
unique[tag] = true
-- place back into an array
taglist = {}
for tag in pairs unique
table.insert taglist, tag
-- sort case-sensitively and then case-insensitively (so capitalized tags appear before their uncapitalized counterparts)
table.sort taglist
table.sort taglist, (a, b) -> a\lower! < b\lower!
return " #{table.concat taglist, " "} "
return {
:process_tags
}