function remove(list, node) {
  if (defined(node.previous) && defined(node.next)) {
    node.previous.next = node.next;
    node.next.previous = node.previous;
  } else if (defined(node.previous)) {
    // Remove last node
    node.previous.next = undefined;
    list.tail = node.previous;
  } else if (defined(node.next)) {
    // Remove first node
    node.next.previous = undefined;
    list.head = node.next;
  } else {
    // Remove last node in the linked list
    list.head = undefined;
    list.tail = undefined;
  }

  node.next = undefined;
  node.previous = undefined;
}
Adds the item to the end of the list
@param {*} [item]
@return {DoublyLinkedListNode}