docs: function slice(tree, from, to) {
  	var max = tree.size;
  
  	if (to === undefined) to = max;
  
  	if (from >= max) {
  		return EMPTY;
  	}
  
  	if (to > max) {
  		to = max;
  	}
  	//invert negative numbers
  	function confine(i) {
  		return i < 0 ? i + max : i;
  	}
  	from = confine(from);
  	to = confine(to);
  	var offset = (0, _util.tailOffset)(tree);var newRoot, newTail;
  	if (from >= offset) {
  		newRoot = null;
  		newTail = tree.tail.slice(from - offset, to - offset);
  	} else if (to <= offset) {
  		newRoot = (0, _slice.sliceRoot)(tree.root, from, to);
  		newTail = [];
  	} else {
  		newRoot = (0, _slice.sliceRoot)(tree.root, from, offset);
  		newTail = tree.tail.slice(0, to - offset);
  	}
  	newTail.height = 0;
  	return new Tree(to - from, newRoot, newTail);
  }