From 336e487270f7b10b868caa4e6649c2e22b0a391b Mon Sep 17 00:00:00 2001 From: Mathew Heard Date: Thu, 2 Dec 2021 13:18:19 +1100 Subject: [PATCH] better node 17 compatibilitiy --- index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 30cc1f0..8f842b6 100644 --- a/index.js +++ b/index.js @@ -245,11 +245,14 @@ if(Util.getPromiseDetails){ return Util.getPromiseDetails(promise)[0] } } else{ + const RejectedPromise = new RegExp("\\{[\\s\n\r]+") + const PendingPromise = new RegExp("\\{[\\s\n\r]+") + _promiseState = function(promise){ const p = util.inspect(promise) - if(p.includes('{ ')){ + if(RejectedPromise.test(p)){ return 2 - } else if(p.includes('{ ')){ + } else if(PendingPromise.test(p)){ return 0 } else{ return 1