Skip to content

Commit

Permalink
#570 Updated how the table entries function is checking if the callba…
Browse files Browse the repository at this point in the history
…ck function is an AsyncFunction

Signed-off-by: Autumn Calhoun <[email protected]>
  • Loading branch information
autumn-calhoun authored and chadlwilson committed Jul 10, 2023
1 parent 679a407 commit 50a272a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion js.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"--init"
]
},
"version": "3.0.0",
"version": "3.0.1",
"gaugeVersionSupport": {
"minimum": "1.0.7",
"maximum": ""
Expand Down
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "gauge-js",
"version": "3.0.0",
"version": "3.0.1",
"description": "JavaScript runner for Gauge",
"main": "index.js",
"scripts": {
Expand Down
8 changes: 4 additions & 4 deletions src/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 50a272a

Please sign in to comment.