emjayess
8/27/2011 - 3:44 PM

advice: existence and type check for function arguments

advice: existence and type check for function arguments

function gimmeh_funcs(myfunc, callback) {

  if (myfunc && typeof myfunc === 'function') {
    /* myfunc is safe to use */
  }

  if (callback && typeof callback === "function") {
    /* callback is safe to use */
  }
}