lib/definitions/saga.js
function (fn) {
    if (!fn || !_.isFunction(fn)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    if (fn.length === 3) {
      this.shouldHandle = fn;
      return this;
    }

    this.shouldHandle = function (evt, saga, callback) {
      callback(null, fn(evt, saga));
    };

    var unwrappedShouldHandle = this.shouldHandle;

    this.shouldHandle = function (evt, saga, clb) {
      var wrappedCallback = function () {
        try {
          clb.apply(this, _.toArray(arguments));
        } catch (e) {
          debug(e);
          process.emit('uncaughtException', e);
        }
      };

      try {
        unwrappedShouldHandle.call(this, evt, saga, wrappedCallback);
      } catch (e) {
        debug(e);
        process.emit('uncaughtException', e);
      }
    };

    return this;
  }
function (fn) {
    if (!fn || !_.isFunction(fn)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    if (fn.length === 3) {
      this.shouldHandle = fn;
      return this;
    }

    this.shouldHandle = function (evt, saga, callback) {
      callback(null, fn(evt, saga));
    };

    var unwrappedShouldHandle = this.shouldHandle;

    this.shouldHandle = function (evt, saga, clb) {
      var wrappedCallback = function () {
        try {
          clb.apply(this, _.toArray(arguments));
        } catch (e) {
          debug(e);
          process.emit('uncaughtException', e);
        }
      };

      try {
        unwrappedShouldHandle.call(this, evt, saga, wrappedCallback);
      } catch (e) {
        debug(e);
        process.emit('uncaughtException', e);
      }
    };

    return this;
  }
function ( fn ) { if ( ! fn || ! _ . isFunction ( fn ) ) { var err = new Error ( 'Please pass a valid function!' ) ; debug ( err ) ; throw err ; } if ( fn . length === 3 ) { this . shouldHandle = fn ; return this ; } this . shouldHandle = function ( evt , saga , callback ) { callback ( null , fn ( evt , saga ) ) ; } ; var unwrappedShouldHandle = this . shouldHandle ; this . shouldHandle = function ( evt , saga , clb ) { var wrappedCallback = function ( ) { try { clb . apply ( this , _ . toArray ( arguments ) ) ; } catch ( e ) { debug ( e ) ; process . emit ( 'uncaughtException' , e ) ; } } ; try { unwrappedShouldHandle . call ( this , evt , saga , wrappedCallback ) ; } catch ( e ) { debug ( e ) ; process . emit ( 'uncaughtException' , e ) ; } } ; return this ; }
Inject shouldHandle function.
@param   {Function}  fn      The function to be injected.
@returns {Saga} to be able to chain...
Inject shouldHandle function .