\href{https://npmjs.org/package/remove-trailing-separator}{\texttt{ }} \href{https://travis-ci.org/darsain/remove-trailing-separator}{\texttt{ }} \href{https://ci.appveyor.com/project/darsain/remove-trailing-separator/branch/master}{\texttt{ }} \href{https://coveralls.io/github/darsain/remove-trailing-separator?branch=master}{\texttt{ }}

Removes all separators from the end of a string.\hypertarget{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24159}{}\doxysection{Install}\label{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24159}

\begin{DoxyCode}{0}
\DoxyCodeLine{npm install remove-\/trailing-\/separator }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24160}{}\doxysection{Examples}\label{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24160}

\begin{DoxyCode}{0}
\DoxyCodeLine{const removeTrailingSeparator = require('remove-\/trailing-\/separator');}
\DoxyCodeLine{}
\DoxyCodeLine{removeTrailingSeparator('/foo/bar/')   // '/foo/bar'}
\DoxyCodeLine{removeTrailingSeparator('/foo/bar///') // '/foo/bar'}
\DoxyCodeLine{}
\DoxyCodeLine{// leaves only/last separator}
\DoxyCodeLine{removeTrailingSeparator('/')    // '/'}
\DoxyCodeLine{removeTrailingSeparator('///')  // '/'}
\DoxyCodeLine{}
\DoxyCodeLine{// returns empty string}
\DoxyCodeLine{removeTrailingSeparator('') // '' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24161}{}\doxysection{Notable backslash, or win32 separator behavior}\label{md_sfcode_node_modules_remove_trailing_separator_readme_autotoc_md24161}
{\ttfamily \textbackslash{}} is considered a separator only on WIN32 systems. All POSIX compliant systems see backslash as a valid file name character, so it would break POSIX compliance to remove it there.

In practice, this means that this code will return different things depending on what system it runs on\+:


\begin{DoxyCode}{0}
\DoxyCodeLine{removeTrailingSeparator('\(\backslash\)\(\backslash\)foo\(\backslash\)\(\backslash\)')}
\DoxyCodeLine{// UNIX  => '\(\backslash\)\(\backslash\)foo\(\backslash\)\(\backslash\)'}
\DoxyCodeLine{// WIN32 => '\(\backslash\)\(\backslash\)foo' }

\end{DoxyCode}
 