mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-06 01:47:48 +00:00
Merging in #194, adding an iterator to _.uniq
This commit is contained in:
@@ -592,12 +592,14 @@ _.difference([1, 2, 3, 4, 5], [5, 2, 10]);
|
||||
</pre>
|
||||
|
||||
<p id="uniq">
|
||||
<b class="header">uniq</b><code>_.uniq(array, [isSorted])</code>
|
||||
<b class="header">uniq</b><code>_.uniq(array, [isSorted], [iterator])</code>
|
||||
<span class="alias">Alias: <b>unique</b></span>
|
||||
<br />
|
||||
Produces a duplicate-free version of the <b>array</b>, using <i>===</i> to test
|
||||
object equality. If you know in advance that the <b>array</b> is sorted,
|
||||
passing <i>true</i> for <b>isSorted</b> will run a much faster algorithm.
|
||||
If you want to compute unique items based on a transformation, pass an
|
||||
<b>iterator</b> function.
|
||||
</p>
|
||||
<pre>
|
||||
_.uniq([1, 2, 1, 3, 1, 4]);
|
||||
|
||||
Reference in New Issue
Block a user