summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSakthipriyan Vairamani <thechargingvolcano@gmail.com>2015-07-15 01:56:54 +0530
committerSakthipriyan Vairamani <thechargingvolcano@gmail.com>2015-07-21 23:24:23 +0530
commit6391f4d2fd7a5779e012887158e6bc69d08966e3 (patch)
tree95a7f2f1a27cb7c38402cfb6985416c99a0da760 /lib
parentb612f085ec12a1937e07867e7d23c5d58022b8ea (diff)
downloadandroid-node-v8-6391f4d2fd7a5779e012887158e6bc69d08966e3.tar.gz
android-node-v8-6391f4d2fd7a5779e012887158e6bc69d08966e3.tar.bz2
android-node-v8-6391f4d2fd7a5779e012887158e6bc69d08966e3.zip
util: removing redundant checks in is* functions
When Object.prototype.toString is used to determine the type, we don't have to explicitly check for other types. This patch removes the redundant checks like that. PR-URL: https://github.com/nodejs/io.js/pull/2179 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Michaƫl Zasso <mic.besace@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/util.js9
1 files changed, 3 insertions, 6 deletions
diff --git a/lib/util.js b/lib/util.js
index 89017450e0..37f2a07ba2 100644
--- a/lib/util.js
+++ b/lib/util.js
@@ -607,8 +607,7 @@ function isUndefined(arg) {
exports.isUndefined = isUndefined;
function isRegExp(re) {
- return re !== null && typeof re === 'object' &&
- objectToString(re) === '[object RegExp]';
+ return objectToString(re) === '[object RegExp]';
}
exports.isRegExp = isRegExp;
@@ -618,14 +617,12 @@ function isObject(arg) {
exports.isObject = isObject;
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 = isError;