Skip to content

Commit f76beab

Browse files
authored
Use literals for creating BigInts when possible (#5093)
1 parent d73f8cb commit f76beab

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/dd-trace/src/datastreams/fnv.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ function fnv64 (data) {
1515
data = Buffer.from(data, 'utf-8')
1616
}
1717
const byteArray = new Uint8Array(data)
18-
return fnv(byteArray, FNV1_64_INIT, FNV_64_PRIME, BigInt(2) ** BigInt(64))
18+
return fnv(byteArray, FNV1_64_INIT, FNV_64_PRIME, 2n ** 64n)
1919
}
2020

2121
module.exports = {

packages/dd-trace/src/debugger/devtools_client/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const expression = `
2525
const threadId = parentThreadId === 0 ? `pid:${process.pid}` : `pid:${process.pid};tid:${parentThreadId}`
2626
const threadName = parentThreadId === 0 ? 'MainThread' : `WorkerThread:${parentThreadId}`
2727

28-
const oneSecondNs = BigInt(1_000_000_000)
29-
let globalSnapshotSamplingRateWindowStart = BigInt(0)
28+
const oneSecondNs = 1_000_000_000n
29+
let globalSnapshotSamplingRateWindowStart = 0n
3030
let snapshotsSampledWithinTheLastSecond = 0
3131

3232
// WARNING: The code above the line `await session.post('Debugger.resume')` is highly optimized. Please edit with care!

packages/dd-trace/test/llmobs/span_processor.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ describe('span processor', () => {
119119
it('removes problematic fields from the metadata', () => {
120120
// problematic fields are circular references or bigints
121121
const metadata = {
122-
bigint: BigInt(1),
122+
bigint: 1n,
123123
deep: {
124124
foo: 'bar'
125125
},

0 commit comments

Comments
 (0)