function splitSort(array) {
  const size = array.length;
  // base case
  if (size < 2) {
    return array;
  } if (size === 2) {
    return array[0] < array[1] ? array : [array[1], array[0]]; // <1>
  }

  // recursive split in half and merge back
  const half = Math.ceil(size / 2);
  return merge( // <3>
    splitSort(array.slice(0, half)), // <2>
    splitSort(array.slice(half)), // <2>
  );
}
Split array in half recursively until two or less elements are left.
Sort these two elements and combine them back using the merge function.
@param {Array} array
@example
   splitSort([3, 2, 1]) => [1, 2, 3]
   splitSort([3]) => [3]
   splitSort([3, 2]) => [2, 3]