Fix lint warnings and errors
This commit is contained in:
parent
591105c553
commit
ca5cac64b3
|
@ -7,7 +7,7 @@ import {functionalInterfaceFactory} from "../functional";
|
|||
|
||||
export {PrivateKey, PublicKey, Signature, init, destroy};
|
||||
|
||||
const bls: IBls = {
|
||||
export const bls: IBls = {
|
||||
PrivateKey,
|
||||
PublicKey,
|
||||
Signature,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import bls from "./index";
|
||||
import {bls} from "./index";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(function (window: any) {
|
||||
|
|
|
@ -1,14 +1,15 @@
|
|||
import {IBls} from "./interface";
|
||||
import blsHerumi from "./herumi";
|
||||
import {bls as blsHerumi} from "./herumi";
|
||||
|
||||
export type Implementation = "herumi" | "blst-native";
|
||||
|
||||
// TODO: Use a Proxy for example to throw an error if it's not initialized yet
|
||||
export let bls: IBls;
|
||||
|
||||
async function getImplementation(impl: Implementation) {
|
||||
async function getImplementation(impl: Implementation): Promise<IBls> {
|
||||
switch (impl) {
|
||||
case "herumi":
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
await blsHerumi.init();
|
||||
return blsHerumi;
|
||||
|
||||
|
@ -16,6 +17,7 @@ async function getImplementation(impl: Implementation) {
|
|||
if (typeof require !== "function") {
|
||||
throw Error("blst-native is only supported in NodeJS");
|
||||
}
|
||||
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
||||
return require("./blst");
|
||||
|
||||
default:
|
||||
|
@ -23,7 +25,7 @@ async function getImplementation(impl: Implementation) {
|
|||
}
|
||||
}
|
||||
|
||||
export async function init(impl: Implementation) {
|
||||
export async function init(impl: Implementation): Promise<void> {
|
||||
bls = await getImplementation(impl);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ export function runBenchmark<T, R>({
|
|||
|
||||
const average = averageBigint(diffsNanoSec);
|
||||
const opsPerSec = 1e9 / Number(average);
|
||||
// eslint-disable-next-line no-console
|
||||
console.log(`${id}: ${opsPerSec.toPrecision(5)} ops/sec (${runs} runs)`); // ±1.74%
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue