From 50a272ab8ebe3428f44b4b750d4c5ee5f98d786c Mon Sep 17 00:00:00 2001 From: Autumn Calhoun Date: Mon, 10 Jul 2023 10:28:02 -0400 Subject: [PATCH] #570 Updated how the table entries function is checking if the callback function is an AsyncFunction Signed-off-by: Autumn Calhoun --- js.json | 2 +- package-lock.json | 7 +++---- package.json | 2 +- src/table.js | 8 ++++---- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/js.json b/js.json index d99cecd..45d83cb 100644 --- a/js.json +++ b/js.json @@ -51,7 +51,7 @@ "--init" ] }, - "version": "3.0.0", + "version": "3.0.1", "gaugeVersionSupport": { "minimum": "1.0.7", "maximum": "" diff --git a/package-lock.json b/package-lock.json index 7f88b67..9de2ca6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "gauge-js", - "version": "3.0.0", + "version": "3.0.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "gauge-js", - "version": "3.0.0", + "version": "3.0.1", "license": "MIT", "dependencies": { "@grpc/grpc-js": "^1.5.5", @@ -2866,8 +2866,7 @@ "version": "5.3.2", "resolved": "https://registry.npmjs.org/acorn-jsx/-/acorn-jsx-5.3.2.tgz", "integrity": "sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==", - "dev": true, - "requires": {} + "dev": true }, "ajv": { "version": "6.12.6", diff --git a/package.json b/package.json index cb0ad11..29507a5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "gauge-js", - "version": "3.0.0", + "version": "3.0.1", "description": "JavaScript runner for Gauge", "main": "index.js", "scripts": { diff --git a/src/table.js b/src/table.js index 278849f..36b0a1a 100644 --- a/src/table.js +++ b/src/table.js @@ -2,12 +2,12 @@ var Table = function (protoTable) { Object.assign(this, protoTable); this.entries = async function (callback) { - const AsyncFunction = (async () => {}).constructor; - for (const row of this.rows) { let entry = {}; - row.cells.forEach((cell, index) => entry[this.headers.cells[index]] = cell); - if(callback instanceof AsyncFunction) { + row.cells.forEach( + (cell, index) => (entry[this.headers.cells[index]] = cell) + ); + if (callback.constructor.name === "AsyncFunction") { await callback(entry); } else { callback(entry);