lib/hooks.js
function(version) {
  var result;
  /** local */
  var ensure = function(key) {
    return function(r) {
      if (r && !r[key]) { throw new Error('result missing ' + key); }
      return r;
    };
  };
  return plugins.first(function(plugin) {
    return Promise.resolve()
    .then(function() { return plugin.match(version); })
    .then(ensure('command'))
    .then(ensure('version'))
    .then(function(r) { return (result = r); });
  })
  .then(function(plugin) {
    return result && _.extend({ plugin: plugin }, result);
  });
}
function(version) {
  var result;
  /** local */
  var ensure = function(key) {
    return function(r) {
      if (r && !r[key]) { throw new Error('result missing ' + key); }
      return r;
    };
  };
  return plugins.first(function(plugin) {
    return Promise.resolve()
    .then(function() { return plugin.match(version); })
    .then(ensure('command'))
    .then(ensure('version'))
    .then(function(r) { return (result = r); });
  })
  .then(function(plugin) {
    return result && _.extend({ plugin: plugin }, result);
  });
}
function ( version ) { var result ; /** local */ var ensure = function ( key ) { return function ( r ) { if ( r && ! r [ key ] ) { throw new Error ( 'result missing ' + key ) ; } return r ; } ; } ; return plugins . first ( function ( plugin ) { return Promise . resolve ( ) . then ( function ( ) { return plugin . match ( version ) ; } ) . then ( ensure ( 'command' ) ) . then ( ensure ( 'version' ) ) . then ( function ( r ) { return ( result = r ) ; } ) ; } ) . then ( function ( plugin ) { return result && _ . extend ( { plugin : plugin } , result ) ; } ) ; }
Find the first plugin that can activate the requested version.

@private
@function hooks.~match
@param {String} version The semver version to activate.
@return {Promise} A promise that resolves with both `version` and `command`
properties.
Find the first plugin that can activate the requested version .