Applies `mapfn` to `node` and the tree below `node`, returning a flattened
list of results.
function treeMap(node, mapfn) {
  var results = [];
  nodeWalk(node, function(node) {
    results = results.concat(mapfn(node));
    return false;
  });
  return results;
}