Code coverage report for git-guppy/index.js

Statements: 93.33% (14 / 15)      Branches: 90% (9 / 10)      Functions: 100% (3 / 3)      Lines: 93.33% (14 / 15)      Ignored: none     

All files » git-guppy/ » index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33    23   23 23   2   2       2     21   19 17 8   9   2 1     1        
'use strict';
 
var getHook = require('./lib/get-hook');
 
module.exports = function (gulp) {
  return {
    stream: function (name) {
      var hook = getHook(name);
 
      Iif (!hook.stream) {
        throw new Error('Hook not streamable: ' + name);
      }
 
      return hook.stream(gulp);
    },
    src: function (name, fn) {
      var hook = getHook(name);
 
      if (fn && typeof fn === 'function') {
        if (hook.extra) {
          return fn.bind(fn, hook.src, hook.extra);
        } else {
          return fn.bind(fn, hook.src);
        }
      } else if (!hook.src) {
        throw new Error('Hook has no source files, use guppy.src() as a callback: ' + name);
      }
 
      return hook.src;
    }
  };
};