Skip to content

micro-js/unique

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unique

Build status Git tag NPM version Code style

Return the unique elements of a list

Installation

$ npm install @f/unique

Usage

var unique = require('@f/unique')

unique([1,2,3,3])       // -> [1, 2, 3]
unique(['c', 'a', 'c']) // -> ['c', 'a']

API

unique(arr, cmp?)

  • arr - Array of values
  • cmp - Optional comparator to determine uniqueness

Returns: An array containing each unique value in arr exactly once.

License

MIT