From 691e739cfa40cd42604dc05a54e6154371a429ab Mon Sep 17 00:00:00 2001 From: Mikhail Bodrov Date: Mon, 27 Dec 2021 22:09:36 +0200 Subject: [PATCH] [Robustness] `stringify`: avoid relying on a global `undefined` (#427) --- lib/stringify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/stringify.js b/lib/stringify.js index 0b21ca75..12a96e65 100644 --- a/lib/stringify.js +++ b/lib/stringify.js @@ -133,7 +133,7 @@ module.exports = function (object, opts) { var obj = object; var options = opts ? utils.assign({}, opts) : {}; - if (options.encoder !== null && options.encoder !== undefined && typeof options.encoder !== 'function') { + if (options.encoder !== null && typeof options.encoder !== 'undefined' && typeof options.encoder !== 'function') { throw new TypeError('Encoder has to be a function.'); }