From 0b5ee0bdf32866900095056dc95bc28f9ae976ee Mon Sep 17 00:00:00 2001 From: Paul Trowbridge Date: Fri, 22 Apr 2022 23:35:48 -0400 Subject: [PATCH] handled a returned array as opposed to a returned object --- index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 52c0e73..1b1dca5 100644 --- a/index.js +++ b/index.js @@ -39,8 +39,12 @@ Postgres.FirstRow = function(inSQL, args, inResponse) { if (err === null) { //need to test if the response is an object or an array //inResponse.json(res.rows[0]); - //if (Array.isArray(res)) {} - inResponse.json(res[1].rows[0]); + if (Array.isArray(res)) { + inResponse.json(res[1].rows[0]); + } + else { + inResponse.json(res.rows[0]); + } return; } console.log(err.stack);