Skip to content

Commit

Permalink
util: don't bother checking types before objectToString()
Browse files Browse the repository at this point in the history
  • Loading branch information
Fishrock123 committed Apr 8, 2015
1 parent d2fe24e commit 50ad0cc
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -546,8 +546,7 @@ exports.isUndefined = deprecate(isUndefined,

// note: the isRegExp function is still used here in util
function isRegExp(re) {
return re !== null && typeof re === 'object' &&
objectToString(re) === '[object RegExp]';
return objectToString(re) === '[object RegExp]';
}
exports.isRegExp = deprecate(isRegExp,
'util.isRegExp is deprecated, please use a user-land alternative.');
Expand All @@ -560,14 +559,12 @@ exports.isObject = deprecate(isObject,

// still used in assert and fs
function isDate(d) {
return d !== null && typeof d === 'object' &&
objectToString(d) === '[object Date]';
return objectToString(d) === '[object Date]';
}
exports.isDate = isDate;

function isError(e) {
return e !== null && typeof e === 'object' &&
(objectToString(e) === '[object Error]' || e instanceof Error);
return objectToString(e) === '[object Error]' || e instanceof Error;
}
exports.isError = deprecate(isError,
'util.isError is deprecated, please use a user-land alternative.');
Expand Down

0 comments on commit 50ad0cc

Please sign in to comment.