From 9d7eeee7d593df4ce1d6c21d1efdae816a47a85d Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 25 Oct 2022 23:49:54 +0200 Subject: [PATCH] Fix an empty object detection implementation MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- is-empty-object.js | 2 +- package.json | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/is-empty-object.js b/is-empty-object.js index b27dc10..909a7d7 100644 --- a/is-empty-object.js +++ b/is-empty-object.js @@ -13,7 +13,7 @@ Benchmark.suite( return Reflect.ownKeys(obj).length === 0 && obj.constructor === Object }), Benchmark.add('Keys iteration ', (obj = testObject) => { - if (obj.constructor !== Object) return false + if (obj?.constructor !== Object) return false // Iterates over the keys of an object, if // any exist, return false. // eslint-disable-next-line no-unreachable-loop diff --git a/package.json b/package.json index 9e88713..5246660 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,9 @@ "name": "benchmarks-js", "version": "0.0.1", "description": "JS code pattern benchmarks", + "engines": { + "node": ">=14.x" + }, "repository": { "type": "git", "url": "git://github.com/jerome-benoit/benchmarks-js.git" -- 2.34.1