Inject shouldHandle function.
@param   {Function}  fn      The function to be injected.
@returns {Saga} to be able to chain...
422494
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;
  }
22706
function callOnce(fn) {
  var called = false

  return calledOnceShim

  //-----------------------------------
  function calledOnceShim() {
    if (called) return
    called = true

    fn.apply(this, arguments)
  }
}
1041640
function(fn) {
				funcGuard(fn);
				if (completeQueue !== noop) {
					throw new Error('queue `then` already set');
				}
				if (!err) {
					completeQueue = fn;
					if (!remaining) {
						complete = true;
						completeQueue(tasks);
					}
				}
				return q;
			}
804269
def call_fn(fn, arglist, env):
  """"""
  if isinstance(fn, framework.LazyFunction):
    # The following looks complicated, but this is necessary because you can't
    # construct closures over the loop variable directly.
    thunks = [(lambda thunk: lambda: framework.eval(thunk, env))(th) for th in arglist.values]
    return fn(*thunks)

  evaled_args = framework.eval(arglist, env)
  if isinstance(fn, framework.EnvironmentFunction):
    return fn(*evaled_args, env=env)

  return fn(*evaled_args)
36560
function(object, callback) {
      return inject(object, [], function(selected, key, value){
        if (callIterator(callback, key, value))
          selected.push(value)
      })
    }
111371
function executePromise(fn, ...args) {
  try {
    // Execute the function. We do not bind a `this` variable. This is
    // expected to be done by the caller.
    const result = fn(...args);
    // If the result is thenable (most likely a promise) then we want to return
    // the result directly. Otherwise we will turn the value into a promise with
    // `Promise.resolve`.
    return result && typeof result.then === 'function'
      ? result
      : Promise.resolve(result);
  } catch (error) {
    // If the functioned errored synchronously we want to return a promise that
    // immeadiately rejects.
    return Promise.reject(error);
  }
}
208496
function fireOnce(fn) {
  var fired = false;
  return function wrapped() {
    if (!fired) {
      fired = true;
      fn.apply(null, arguments);
    }
  };
}
803493
function (fn) {
    if (!fn || !_.isFunction(fn)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    this.onEventMissingHandle = fn;

    return this;
  }
637117
function(fn)
    {
        return this.execute().then(function(res) {
            return _(res).reduce(function(acc, x) {
                return acc + (0|fn(x));
            }, 0);
        });
    }
111009
function once (fn) {
  var done = false
  return function (err, val) {
    if(done) return
    done = true
    fn(err, val)
  }
}
448073
function(fn) {
		return function() {
			var realArgs = [];
			var fnArgs = arguments;
			each(fnArgs, function(val, i) {
				if (i <= fnArgs.length) {
					while (val && val.isComputed) {
						val = val();
					}
					realArgs.push(val);
				}
			});
			return fn.apply(this, realArgs);
		};
	}
167316
function bind (fn) {
          if (typeof fn !== 'function') return fn
          return ins.bindFunction(function (val) {
            var result = (promise.__ob_wrapper || propagateObWrapper)(this, fn, val, next)
            if (result.error) {
              throw result.errorVal
            } else {
              return result.returnVal
            }
          })
        }
217396
function injectAdditionalFunctions (funcs, additionalFunctions) {
  // Nothing to do if no additional function is given.
  if (no(additionalFunctions)) return

  /**
   * Validate and insert an additional function.
   */

  function injectAdditionalFunction (key) {
    var isAFunction = typeof additionalFunctions[key] === 'function'

    if (isAFunction) funcs[key] = additionalFunctions[key]
  }

  Object.keys(additionalFunctions)
    .forEach(injectAdditionalFunction)
}
124974
function wrapFunctionToReturnPromise(fn, Promise) {
	return function() {
		try {
			const result = fn.apply(this, arguments);
			if (result instanceof Promise) return result;
			return Promise.resolve(result);
		} catch (err) {
			return new Promise((resolve, reject) => { // jshint ignore:line
				reject(err);
			});
		}
	};
}
1350566
function (fn) {
            if (domReady) {
                try {
                    fn(S);
                } catch (e) {
                    setTimeout(function () {
                        throw e;
                    }, 0);
                }
            } else {
                callbacks.push(fn);
            }
            return this;
        }
885917
function (fn) {
    if (!fn || !_.isFunction(fn)) {
      var err = new Error('Please pass a valid function!');
      debug(err);
      throw err;
    }

    this.structureLoader = customLoader(fn);

    return this;
  }
820342
function once (fn) {
  var called = false;
  return function () {
    if (!called) {
      called = true;
      fn.apply(this, arguments);
    }
  }
}