lib/optimiser.js
function findUnusedVariableDeclarators (ast) {
  var unused = [];
  traverse.traverse(ast, {
    enter: function (node, parent) {
      var scope, refs;
      if (node.type === 'VariableDeclarator' && (scope = findScope(ast, node))) {
        refs = fast.filter(findVariableReferences(scope, node.id), function (item) {
          return item !== node.id;
        });

        if (!refs.length) {
          unused.push(node);
        }
      }
    }
  });
  return unused;
}
function findUnusedVariableDeclarators (ast) {
  var unused = [];
  traverse.traverse(ast, {
    enter: function (node, parent) {
      var scope, refs;
      if (node.type === 'VariableDeclarator' && (scope = findScope(ast, node))) {
        refs = fast.filter(findVariableReferences(scope, node.id), function (item) {
          return item !== node.id;
        });

        if (!refs.length) {
          unused.push(node);
        }
      }
    }
  });
  return unused;
}
function findUnusedVariableDeclarators ( ast ) { var unused = [ ] ; traverse . traverse ( ast , { enter : function ( node , parent ) { var scope , refs ; if ( node . type === 'VariableDeclarator' && ( scope = findScope ( ast , node ) ) ) { refs = fast . filter ( findVariableReferences ( scope , node . id ) , function ( item ) { return item !== node . id ; } ) ; if ( ! refs . length ) { unused . push ( node ) ; } } } } ) ; return unused ; }
Find declarators of unused variables.
Find declarators of unused variables .