Yep, you are right, just readability of this line:

    } else if (typeof(arg) === 'object' && (arg.id || arg.constructor.name !== 'ObjectID')) {

because code `A && B && C` reads easier than `A && (B || C)`

Also `typeof` is not a function, it's an operator like `instanceof` and `delete` and should be written without parentheses, and even better with reverse order of arguments:

    'object' == typeof arg