From 5de2f1996f22ad006460110817ab31c8810dcaf5 Mon Sep 17 00:00:00 2001 From: Franck Royer Date: Fri, 29 Apr 2022 18:20:39 +1000 Subject: [PATCH] Facilitate the use of a polyfill for `BigInt` By preferring the use of `BigInt` over integer literal (`n` postfix). --- CHANGELOG.md | 4 ++++ src/lib/enr/enr.spec.ts | 2 +- src/lib/enr/enr.ts | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 391426fa72..fc5bc49ea7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed + +- Prefer the use of `BigInt` over integer literal (`n` postfix) to facilitate the use of a polyfill. + ### Fixed - Declare `it-pipe` dependency, import as per `it-pipe@2.0.0` convention. diff --git a/src/lib/enr/enr.spec.ts b/src/lib/enr/enr.spec.ts index ee38c2cca1..a216f0bac2 100644 --- a/src/lib/enr/enr.spec.ts +++ b/src/lib/enr/enr.spec.ts @@ -180,7 +180,7 @@ describe("ENR", function () { let record: ENR; beforeEach(() => { - const seq = 1n; + const seq = BigInt(1); privateKey = hexToBytes( "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" ); diff --git a/src/lib/enr/enr.ts b/src/lib/enr/enr.ts index 17787e6491..049ece3f95 100644 --- a/src/lib/enr/enr.ts +++ b/src/lib/enr/enr.ts @@ -32,7 +32,7 @@ export class ENR extends Map { constructor( kvs: Record = {}, - seq: SequenceNumber = 1n, + seq: SequenceNumber = BigInt(1), signature: Uint8Array | null = null ) { super(Object.entries(kvs));