code: function replaceNode(ancestors, node) {
    const ancestor = ancestors[ancestors.length - 1];
  
    if (typeof ancestor.index === "number") {
      ancestor.node[ancestor.key][ancestor.index] = node;
    } else {
      ancestor.node[ancestor.key] = node;
    }
  }
docs: NOTE: this will only work if we are replacing an original identifier