code: function isModuleInstalledGlobally(name, fn) {
    var cmd = 'npm ls --global --json --depth=0';
    exec(cmd, function(err, stdout) {
      if (err) {
        return fn(err);
      }
  
      var data = JSON.parse(stdout);
      var installed = data.dependencies[name];
      fn(null, installed !== undefined);
    });
  }
docs: Check if a module with `name` is installed globally.
  
  @param {String} name of the module, e.g. jshint
  @param {Function} fn (error, exists)