function isLast (doc, containerPath, coor) {
  if (coor.isNodeCoordinate()) {
    return coor.offset > 0
  }
  const node = getContainerRoot(doc, containerPath, coor.path[0])
  if (node.isText()) {
    return coor.offset >= node.getLength()
  }
  if (node.isList()) {
    const itemId = coor.path[0]
    const item = doc.get(itemId)
    return (last(node.items) === itemId && coor.offset === item.getLength())
  }
  return false
}
Helper to check if a coordinate is the last position of a node.
Attention: this works only for Text and List nodes