- Alias: fjs.unique
- Alias: fjs.distinct
fjs.nub removes duplicate elements from a list and returns a new array containing only the unique elements. fjs.nub takes an iterator function and a list to apply the iterator to. The iterator function takes two given elements from the list and determines if they are the same, and therefore unique, or not. Can be curried by default.
fjs.nub returns only the first unique element found in a list. This behavior is more apparent when applied to a list of more complex objects. Care should be taken when using this function for very large lists, as fjs.nub is at worst O(n^2) for lists containing only unique elements.