index.js
function freshVars(node){
  switch (node.type) {
    case 'VariableDeclaration':
      return node.declarations.map(function(n){ return n.id })
    case 'FunctionExpression': return [] // early exit
    case 'FunctionDeclaration':
      return [node.id]
  }
  return children(node)
    .map(freshVars)
    .reduce(concat, [])
}
function freshVars(node){
  switch (node.type) {
    case 'VariableDeclaration':
      return node.declarations.map(function(n){ return n.id })
    case 'FunctionExpression': return [] // early exit
    case 'FunctionDeclaration':
      return [node.id]
  }
  return children(node)
    .map(freshVars)
    .reduce(concat, [])
}
function freshVars ( node ) { switch ( node . type ) { case 'VariableDeclaration' : return node . declarations . map ( function ( n ) { return n . id } ) case 'FunctionExpression' : return [ ] // early exit case 'FunctionDeclaration' : return [ node . id ] } return children ( node ) . map ( freshVars ) . reduce ( concat , [ ] ) }
get all declared variables within `node`'s scope

@param {AST} node
@return {Array}
get all declared variables within node s scope