From 2b8b23067d4211014dd192e6ef774178725c9209 Mon Sep 17 00:00:00 2001 From: cjihrig Date: Mon, 10 Jun 2019 21:19:44 -0700 Subject: [PATCH] perf_hooks,trace_events: use stricter equality There is no need to use loose equality on these checks because undefined is caught by the preceding typeof check. PR-URL: https://github.com/nodejs/node/pull/28166 Reviewed-By: Luigi Pinca Reviewed-By: Rich Trott Reviewed-By: Richard Lau Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Yongsheng Zhang --- lib/perf_hooks.js | 2 +- lib/trace_events.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/perf_hooks.js b/lib/perf_hooks.js index 83e43af6cfd181..d822c5de71bd46 100644 --- a/lib/perf_hooks.js +++ b/lib/perf_hooks.js @@ -332,7 +332,7 @@ class PerformanceObserver extends AsyncResource { } observe(options) { - if (typeof options !== 'object' || options == null) { + if (typeof options !== 'object' || options === null) { throw new ERR_INVALID_ARG_TYPE('options', 'Object', options); } if (!Array.isArray(options.entryTypes)) { diff --git a/lib/trace_events.js b/lib/trace_events.js index 0d533c76a78253..f142afded15d56 100644 --- a/lib/trace_events.js +++ b/lib/trace_events.js @@ -73,7 +73,7 @@ class Tracing { } function createTracing(options) { - if (typeof options !== 'object' || options == null) + if (typeof options !== 'object' || options === null) throw new ERR_INVALID_ARG_TYPE('options', 'object', options); if (!Array.isArray(options.categories)) {