From e91d00732609b216fc67b3e69c78d675d4208677 Mon Sep 17 00:00:00 2001 From: Mike Date: Fri, 15 Feb 2019 11:46:03 -0700 Subject: [PATCH] falsey values for replacer should be allowed JSON.stringify is happy with falsey values for replacer and 0 is shorter than null --- stringify.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stringify.js b/stringify.js index 124a452..4384173 100644 --- a/stringify.js +++ b/stringify.js @@ -22,6 +22,6 @@ function serializer(replacer, cycleReplacer) { } else stack.push(value) - return replacer == null ? value : replacer.call(this, key, value) + return !replacer ? value : replacer.call(this, key, value) } }