Removes all duplicates from an array in place.\hypertarget{md_sfcode_node_modules_uniq_README_autotoc_md31300}{}\doxysection{Usage}\label{md_sfcode_node_modules_uniq_README_autotoc_md31300}
First install using npm\+: \begin{DoxyVerb}npm install uniq
\end{DoxyVerb}
 Then use it as follows\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{var arr = [1, 1, 2, 2, 3, 5]}
\DoxyCodeLine{}
\DoxyCodeLine{require("{}uniq"{})(arr)}
\DoxyCodeLine{console.log(arr)}
\DoxyCodeLine{}
\DoxyCodeLine{//Prints:}
\DoxyCodeLine{//}
\DoxyCodeLine{//  1,2,3,5}
\DoxyCodeLine{// }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_uniq_README_autotoc_md31301}{}\doxysubsection{$<$tt$>$require(\char`\"{}uniq\char`\"{})(array\mbox{[}, compare, sorted\mbox{]})$<$/tt$>$}\label{md_sfcode_node_modules_uniq_README_autotoc_md31301}
Removes all duplicates from a sorted array in place.


\begin{DoxyItemize}
\item {\ttfamily array} is the array to remove items from
\item {\ttfamily compare} is an optional comparison function that returns 0 when two items are equal, and something non-\/zero when they are different. If unspecified, then the default equals will be used.
\item {\ttfamily sorted} if true, then assume array is already sorted
\end{DoxyItemize}

{\bfseries{Returns\+:}} A reference to {\ttfamily array}

{\bfseries{Time Complexity\+:}} {\ttfamily O(array.\+length $\ast$ log(arra.\+length))} or {\ttfamily O(array.\+length)} if {\ttfamily sorted}\hypertarget{md_sfcode_node_modules_uniq_README_autotoc_md31302}{}\doxysubsection{Why use this instead of underscore.\+uniq\mbox{[}ue\mbox{]}?}\label{md_sfcode_node_modules_uniq_README_autotoc_md31302}
A few reasons\+:


\begin{DoxyItemize}
\item This library updates the array in place without making an extra copy (and so it is faster for large arrays)
\item It also accepts a custom comparison function so you can remove duplicates from arrays containing object
\item It is more modular in the sense that it doesn\textquotesingle{}t come with a bazillion other utility grab bag functions.
\end{DoxyItemize}\hypertarget{md_sfcode_node_modules_uniq_README_autotoc_md31303}{}\doxysection{Credits}\label{md_sfcode_node_modules_uniq_README_autotoc_md31303}
(c) 2013 Mikola Lysenko. MIT License 