function node (parent, key, depth) {
  if (parent.depth === depth) {
    return node(parent.parent, key, depth)
  }

  var child = {
    parent,
    key,
    depth,
    children: []
  }

  parent.children.push(child)

  return child
}
creates a new node in the tree, attaching it as a child of the provided parent node
if the specified depth matches the parent depth, adds the new node as a _sibling_ of the parent instead
@param {TreeNode} parent the parent node to add a new node to (if the parent depth matches the provided `depth` value, will instead add as a sibling of this
@param {string} key the key that the new node represents (key here being part of the path being redacted)
@param {number} depth the depth of the new node in the tree - used to determing whether to add the new node as a child or sibling of the provided `parent` node
@returns {TreeNode} a reference to the newly created node in the tree