// remove all children of the main `g` element
// prepare for re-drawing (e.g. during resize) with margins
export default ({
  g,
  margin
}) => {
  g.selectAll('*').remove()
  g.append('g')
      .attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
}

// remove all children of the main `g` element
// and all children of the base `element` that are flagged with a css class named `--delete-on-update`
// prepare for re-drawing (e.g. during resize) with margins
export default ({
  g,
  element,
  margin
}) => {
  element.selectAll('.--delete-on-update').remove()
  g.selectAll('*').remove()
  g.attr('transform', 'translate(' + margin.left + ',' + margin.top + ')')
}

Fix duplicate `g` elements, add `--delete-on-update` class
Utils/draw: Fix duplicate `g` elements, add `--delete-on-update` class
