From: Jérôme Benoit Date: Fri, 25 Aug 2023 17:45:01 +0000 (+0200) Subject: fix: workaround node 16 issue with crypto named export X-Git-Tag: v2.6.35~5 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=56ea99c2ba591a9797a21e317d666b0f8bce8a66;p=poolifier.git fix: workaround node 16 issue with crypto named export Signed-off-by: Jérôme Benoit --- diff --git a/src/utils.ts b/src/utils.ts index 6178d8f1..33ec019d 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,5 @@ import * as os from 'node:os' -import { getRandomValues } from 'node:crypto' +import * as crypto from 'node:crypto' import type { MeasurementStatisticsRequirements, WorkerChoiceStrategyOptions @@ -254,5 +254,5 @@ export const once = ( * @returns A number in the [0,1[ range */ export const secureRandom = (): number => { - return getRandomValues(new Uint32Array(1))[0] / 0x100000000 + return crypto.getRandomValues(new Uint32Array(1))[0] / 0x100000000 }