All files / src linked-list.js

100% Statements 3/3
100% Branches 0/0
100% Functions 3/3
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 11 12 13    5x     4x         1x    
export default function createLinkedList(items) {
  function advanceList(toIndex) {
    return {
      value: items[toIndex],
      next: function getNextItem(nextIndex) {
        return advanceList(nextIndex);
      }.bind(null, toIndex + 1),
    };
  }
 
  return advanceList(0);
}