jwhitley/r.js — comment on commit a13b025ac3ad97d03131565d6a73a87df8055c58
File: build/jslib/x.js line 177
By aradabaugh:

I see. Maybe `if ( callback != null ) {`? That checks for both null and
undefined with less bytes.

On Mon, Dec 5, 2011 at 9:08 PM, John Whitley <
reply@reply.github.com
> wrote:

> @aradabaugh I'd thought of that, but that would silently eat all invalid
> parameters. I'd prefer to have this code fail early and hard on bad input
> for the callback param, and so went with this as a straightforward
> approach. With testing for function, this code would need to go to
> something like:
>
> ```javascript
> if ( typeof callback === "function" ) {
> //...
> } else {
> throw //...
> }
> ```
>
> ---
> Reply to this email directly or view it on GitHub:
>
> https://github.com/jwhitley/r.js/commit/a13b025ac3ad97d03131565d6a73a87df8055c58#commitcomment-771188
>