function getEdgeTextChild(node, end) {
    /**
     * This was changed from a ternary to a long form if due to issues with istanbul's instrumentation and babel's code
     * generation.
     * TODO: watch https://github.com/istanbuljs/babel-plugin-istanbul/issues/95
     * when it is resolved then revert to ```const findFn = end ? findLast : find;```
     */
    let findFn;
    if (end) {
      findFn = findLast;
    } else {
      findFn = find;
    }

    let edgeChildWithValue;
    setEdgeChildWithValue(node);
    return edgeChildWithValue;

    /**
     * searchChildren checks a node and all of it's children deeply to find a
     * non-blank text value. When the text node is found, we set it in an outside
     * variable, as it may be deep in the tree and therefore wouldn't be returned
     * by `find`/`findLast`.
     */
    function setEdgeChildWithValue(child) {
      if (!edgeChildWithValue && child.value) {
        edgeChildWithValue = child;
      }
      findFn(child.children, setEdgeChildWithValue);
    }
  }
Get the first or last non-blank text child of a node, regardless of
nesting. If `end` is truthy, get the last node, otherwise first.