From: Jérôme Benoit Date: Tue, 25 Oct 2022 21:49:54 +0000 (+0200) Subject: Fix an empty object detection implementation X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=9d7eeee7d593df4ce1d6c21d1efdae816a47a85d;p=benchmarks-js.git Fix an empty object detection implementation Signed-off-by: Jérôme Benoit --- 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"