code: function extractVars(path) {
      const declarators = [];
  
      if (path.isVariableDeclaration({ kind: "var" })) {
        for (const decl of path.node.declarations) {
          const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id));
  
          declarators.push(
            ...bindingIds.map(name => t.variableDeclarator(t.identifier(name)))
          );
        }
      } else {
        path.traverse({
          VariableDeclaration(varPath) {
            if (!varPath.isVariableDeclaration({ kind: "var" })) return;
  
            if (!isSameFunctionScope(varPath, path)) return;
  
            for (const decl of varPath.node.declarations) {
              const bindingIds = Object.keys(t.getBindingIdentifiers(decl.id));
              declarators.push(
                ...bindingIds.map(name =>
                  t.variableDeclarator(t.identifier(name))
                )
              );
            }
          }
        });
      }
  
      if (declarators.length <= 0) return [];
  
      return [t.variableDeclaration("var", declarators)];
    }
docs: Extracts vars from a path Useful for removing blocks or paths that can contain variable declarations inside them Note: drops are inits extractVars({ var x = 5, y = x }) => var x, y;