From f8c8db50b099962376d872349e4f83130a0f26e2 Mon Sep 17 00:00:00 2001 From: Anthony <769245+devshark@users.noreply.github.com> Date: Fri, 18 Jun 2021 15:05:23 +0800 Subject: [PATCH 1/2] A proposed fix to ensure "true" is never hardcoded Solves issue #19 --- index.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 2e4f1c7..5e30cce 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ module.exports = function aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue () { - return true; + return function (undefined) { + return !undefined + }(); }; - From c0a870a48043c334c535344300f3be8e0865bc48 Mon Sep 17 00:00:00 2001 From: Anthony Lim Date: Mon, 21 Jun 2021 18:01:54 +0800 Subject: [PATCH 2/2] switched type-coercion to equality --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 5e30cce..4305e74 100644 --- a/index.js +++ b/index.js @@ -1,5 +1,5 @@ module.exports = function aJavaScriptPortOfTheUnixUtilityTrueReturnsTheBooleanValueTrue () { - return function (undefined) { - return !undefined + return function (undefined, anotherUndefined) { + return undefined === anotherUndefined; }(); };