[lib] add commaList, hasElement and validNick helper functions.