docs: function swap(states) {
    let newStates = Array.apply(null, Array(states.length)).map(() => []);
  
    states.forEach((state, i) => {
      state.forEach((earleyItem) => {
        newStates[earleyItem.origin].push(earleyItem);
        earleyItem.origin = i;
      });
    });
    return newStates;
  }