package util // UniqueNonEmptyElementsOf returns a new slice containing unique non-empty elements from the input slice. // It removes duplicate elements and empty strings while preserving the order of appearance. func UniqueNonEmptyElementsOf(s []string) []string { // Create a map to store unique elements unique := make(map[string]bool) // Create a new slice to store the unique non-empty elements us := make([]string, 0, len(s)) for _, elem := range s { // Skip empty strings if len(elem) == 0 { continue } // Check if the element is already in the unique map if !unique[elem] { // Add the element to the unique map and the new slice unique[elem] = true us = append(us, elem) } } return us }