From 4844cefea9bfe0ed8ef619cb4215d6b37ca6f399 Mon Sep 17 00:00:00 2001 From: Chris Duncan Date: Fri, 6 Dec 2024 14:19:29 -0800 Subject: [PATCH] Remove unnecessary type check used when polyfilling for node. --- src/lib/nano-nacl.ts | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/lib/nano-nacl.ts b/src/lib/nano-nacl.ts index 27cba26..37d9314 100644 --- a/src/lib/nano-nacl.ts +++ b/src/lib/nano-nacl.ts @@ -21,17 +21,15 @@ const n = () => { /** * Listens for messages from a calling function. */ - if (typeof addEventListener === 'function') { - addEventListener('message', (message: any): void => { - const data = JSON.parse(new TextDecoder().decode(message.data ?? message)) - for (const d of data) { - d.publicKey = convert(d.privateKey) - } - const buf = new TextEncoder().encode(JSON.stringify(data)).buffer - //@ts-expect-error - postMessage(buf, [buf]) - }) - } + addEventListener('message', (message: any): void => { + const data = JSON.parse(new TextDecoder().decode(message.data ?? message)) + for (const d of data) { + d.publicKey = convert(d.privateKey) + } + const buf = new TextEncoder().encode(JSON.stringify(data)).buffer + //@ts-expect-error + postMessage(buf, [buf]) + }) const gf = function (init?: number[]): Float64Array { const r = new Float64Array(16) -- 2.34.1