From 68aac9a2018aa840887f84d5140c9bf329b8151d Mon Sep 17 00:00:00 2001 From: RafaelGSS Date: Wed, 18 Sep 2024 15:49:51 -0300 Subject: [PATCH] lib: use util.isAsyncFunction --- lib/clock.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/clock.js b/lib/clock.js index edd4490..c1192d8 100644 --- a/lib/clock.js +++ b/lib/clock.js @@ -1,4 +1,4 @@ -const { debug } = require('node:util'); +const { debug, types } = require('node:util'); const { validateNumber } = require('./validators'); let debugBench = debug('benchmark', (fn) => { @@ -199,7 +199,7 @@ const SyncFunction = function () { }.constructor; function createRunner(bench, recommendedCount) { - const isAsync = bench.fn.constructor === AsyncFunction; + const isAsync = types.isAsyncFunction(bench.fn); const hasArg = bench.fn.length >= 1; if (bench.fn.length > 1) {