From 3f6bbab977253f48f580e8231a71a52ba9eff724 Mon Sep 17 00:00:00 2001 From: Rasmus Porsager Date: Thu, 1 Oct 2020 01:18:46 +0200 Subject: [PATCH] Fix support for node 8 and 10 --- lib/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/index.js b/lib/index.js index 17b1d7c0..a3321961 100644 --- a/lib/index.js +++ b/lib/index.js @@ -200,7 +200,7 @@ function Postgres(a, b) { function nested(first, rest) { const o = Object.create(notPromise) o.first = first - o.rest = rest.flat() + o.rest = rest.reduce((acc, val) => acc.concat(val), []) return o } @@ -353,7 +353,7 @@ function Postgres(a, b) { onclose: () => { Object.entries(listeners).forEach(([channel, fns]) => { delete listeners[channel] - Promise.allSettled(fns.map(fn => listen(channel, fn))) + Promise.all(fns.map(fn => listen(channel, fn).catch(() => { /* noop */ }))) }) } },