Yet Another Linked List

There are many doubly-\/linked list implementations like it, but this one is mine.

For when an array would be too big, and a Map can\textquotesingle{}t be iterated in reverse order.

\href{https://travis-ci.org/isaacs/yallist}{\texttt{ }} \href{https://coveralls.io/github/isaacs/yallist}{\texttt{ }}\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16906}{}\doxysection{basic usage}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16906}

\begin{DoxyCode}{0}
\DoxyCodeLine{var yallist = require('yallist')}
\DoxyCodeLine{var myList = yallist.create([1, 2, 3])}
\DoxyCodeLine{myList.push('foo')}
\DoxyCodeLine{myList.unshift('bar')}
\DoxyCodeLine{// of course pop() and shift() are there, too}
\DoxyCodeLine{console.log(myList.toArray()) // ['bar', 1, 2, 3, 'foo']}
\DoxyCodeLine{myList.forEach(function (k) \{}
\DoxyCodeLine{  // walk the list head to tail}
\DoxyCodeLine{\})}
\DoxyCodeLine{myList.forEachReverse(function (k, index, list) \{}
\DoxyCodeLine{  // walk the list tail to head}
\DoxyCodeLine{\})}
\DoxyCodeLine{var myDoubledList = myList.map(function (k) \{}
\DoxyCodeLine{  return k + k}
\DoxyCodeLine{\})}
\DoxyCodeLine{// now myDoubledList contains ['barbar', 2, 4, 6, 'foofoo']}
\DoxyCodeLine{// mapReverse is also a thing}
\DoxyCodeLine{var myDoubledListReverse = myList.mapReverse(function (k) \{}
\DoxyCodeLine{  return k + k}
\DoxyCodeLine{\}) // ['foofoo', 6, 4, 2, 'barbar']}
\DoxyCodeLine{}
\DoxyCodeLine{var reduced = myList.reduce(function (set, entry) \{}
\DoxyCodeLine{  set += entry}
\DoxyCodeLine{  return set}
\DoxyCodeLine{\}, 'start')}
\DoxyCodeLine{console.log(reduced) // 'startfoo123bar' }

\end{DoxyCode}
\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16907}{}\doxysection{api}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16907}
The whole API is considered \char`\"{}public\char`\"{}.

Functions with the same name as an Array method work more or less the same way.

There\textquotesingle{}s reverse versions of most things because that\textquotesingle{}s the point.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16908}{}\doxysubsection{Yallist}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16908}
Default export, the class that holds and manages a list.

Call it with either a for\+Each-\/able (like an array) or a set of arguments, to initialize the list.

The Array-\/ish methods all act like you\textquotesingle{}d expect. No magic length, though, so if you change that it won\textquotesingle{}t automatically prune or add empty spots.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16909}{}\doxysubsection{Yallist.\+create(..)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16909}
Alias for Yallist function. Some people like factories.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16910}{}\doxysubsubsection{yallist.\+head}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16910}
The first node in the list\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16911}{}\doxysubsubsection{yallist.\+tail}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16911}
The last node in the list\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16912}{}\doxysubsubsection{yallist.\+length}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16912}
The number of nodes in the list. (Change this at your peril. It is not magic like Array length.)\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16913}{}\doxysubsubsection{yallist.\+to\+Array()}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16913}
Convert the list to an array.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16914}{}\doxysubsubsection{yallist.\+for\+Each(fn, \mbox{[}thisp\mbox{]})}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16914}
Call a function on each item in the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16915}{}\doxysubsubsection{yallist.\+for\+Each\+Reverse(fn, \mbox{[}thisp\mbox{]})}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16915}
Call a function on each item in the list, in reverse order.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16916}{}\doxysubsubsection{yallist.\+get(n)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16916}
Get the data at position {\ttfamily n} in the list. If you use this a lot, probably better off just using an Array.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16917}{}\doxysubsubsection{yallist.\+get\+Reverse(n)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16917}
Get the data at position {\ttfamily n}, counting from the tail.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16918}{}\doxysubsubsection{yallist.\+map(fn, thisp)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16918}
Create a new Yallist with the result of calling the function on each item.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16919}{}\doxysubsubsection{yallist.\+map\+Reverse(fn, thisp)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16919}
Same as {\ttfamily map}, but in reverse.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16920}{}\doxysubsubsection{yallist.\+pop()}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16920}
Get the data from the list tail, and remove the tail from the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16921}{}\doxysubsubsection{yallist.\+push(item, ...)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16921}
Insert one or more items to the tail of the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16922}{}\doxysubsubsection{yallist.\+reduce(fn, initial\+Value)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16922}
Like Array.\+reduce.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16923}{}\doxysubsubsection{yallist.\+reduce\+Reverse}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16923}
Like Array.\+reduce, but in reverse.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16924}{}\doxysubsubsection{yallist.\+reverse}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16924}
Reverse the list in place.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16925}{}\doxysubsubsection{yallist.\+shift()}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16925}
Get the data from the list head, and remove the head from the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16926}{}\doxysubsubsection{yallist.\+slice(\mbox{[}from\mbox{]}, \mbox{[}to\mbox{]})}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16926}
Just like Array.\+slice, but returns a new Yallist.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16927}{}\doxysubsubsection{yallist.\+slice\+Reverse(\mbox{[}from\mbox{]}, \mbox{[}to\mbox{]})}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16927}
Just like yallist.\+slice, but the result is returned in reverse.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16928}{}\doxysubsubsection{yallist.\+to\+Array()}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16928}
Create an array representation of the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16929}{}\doxysubsubsection{yallist.\+to\+Array\+Reverse()}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16929}
Create a reversed array representation of the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16930}{}\doxysubsubsection{yallist.\+unshift(item, ...)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16930}
Insert one or more items to the head of the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16931}{}\doxysubsubsection{yallist.\+unshift\+Node(node)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16931}
Move a Node object to the front of the list. (That is, pull it out of wherever it lives, and make it the new head.)

If the node belongs to a different list, then that list will remove it first.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16932}{}\doxysubsubsection{yallist.\+push\+Node(node)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16932}
Move a Node object to the end of the list. (That is, pull it out of wherever it lives, and make it the new tail.)

If the node belongs to a list already, then that list will remove it first.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16933}{}\doxysubsubsection{yallist.\+remove\+Node(node)}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16933}
Remove a node from the list, preserving referential integrity of head and tail and other nodes.

Will throw an error if you try to have a list remove a node that doesn\textquotesingle{}t belong to it.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16934}{}\doxysubsection{Yallist.\+Node}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16934}
The class that holds the data and is actually the list.

Call with {\ttfamily var n = new Node(value, previous\+Node, next\+Node)}

Note that if you do direct operations on Nodes themselves, it\textquotesingle{}s very easy to get into weird states where the list is broken. Be careful \+:)\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16935}{}\doxysubsubsection{node.\+next}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16935}
The next node in the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16936}{}\doxysubsubsection{node.\+prev}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16936}
The previous node in the list.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16937}{}\doxysubsubsection{node.\+value}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16937}
The data the node contains.\hypertarget{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16938}{}\doxysubsubsection{node.\+list}\label{md_sfcode_node_modules_make_fetch_happen_node_modules_yallist_README_autotoc_md16938}
The list to which this node belongs. (Null if it does not belong to any list.) 