lib/optimiser.js
function removeUnusedVariableDeclarators (ast) {
  var unused = findUnusedVariableDeclarators(ast);
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type !== 'VariableDeclaration') {
        return;
      }
      node.declarations = fast.filter(node.declarations, function (item) {
        return !~fast.indexOf(unused, item);
      });
    }
  });
  return ast;
}
function removeUnusedVariableDeclarators (ast) {
  var unused = findUnusedVariableDeclarators(ast);
  traverse.traverse(ast, {
    enter: function (node, parent) {
      if (node.type !== 'VariableDeclaration') {
        return;
      }
      node.declarations = fast.filter(node.declarations, function (item) {
        return !~fast.indexOf(unused, item);
      });
    }
  });
  return ast;
}
function removeUnusedVariableDeclarators ( ast ) { var unused = findUnusedVariableDeclarators ( ast ) ; traverse . traverse ( ast , { enter : function ( node , parent ) { if ( node . type !== 'VariableDeclaration' ) { return ; } node . declarations = fast . filter ( node . declarations , function ( item ) { return ! ~ fast . indexOf ( unused , item ) ; } ) ; } } ) ; return ast ; }
If a variable is declared, but not used, remove it.
If a variable is declared but not used remove it .