-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Double negation considered slower than a straight null check.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -544,7 +544,7 @@ exports.isRegExp = isRegExp; | |
|
||
function isObject(arg) { | ||
var type = typeof arg; | ||
return type === 'function' || type === 'object' && !!arg; | ||
return type === 'function' || type === 'object' && arg !== null; | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
chrisdickinson
|
||
} | ||
exports.isObject = isObject; | ||
|
||
|
if we are going for perf tweaks, there was a discussion recently on something similar which noted that setting a var is less efficient. (not setting one allows it to inline better I think.)
ala
Edit: here's a source: nodejs#847 (comment)