function getElementIds(list) {
  if (list instanceof Text) {
    return list.elems.map(elem => elem.elemId)
  } else {
    return list[ELEM_IDS]
  }
}
Given an array or text object from an Automerge document, returns an array
containing the unique element ID of each list element/character.