@gmod/bam 2.0.3 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/util.ts CHANGED
@@ -6,16 +6,6 @@ export function timeout(ms: number) {
6
6
  return new Promise(resolve => setTimeout(resolve, ms))
7
7
  }
8
8
 
9
- export function longToNumber(long: Long) {
10
- if (
11
- long.greaterThan(Number.MAX_SAFE_INTEGER) ||
12
- long.lessThan(Number.MIN_SAFE_INTEGER)
13
- ) {
14
- throw new Error('integer overflow')
15
- }
16
- return long.toNumber()
17
- }
18
-
19
9
  /**
20
10
  * Properly check if the given AbortSignal is aborted.
21
11
  * Per the standard, if the signal reads as aborted,
@@ -113,13 +103,12 @@ export function optimizeChunks(chunks: Chunk[], lowest?: VirtualOffset) {
113
103
  }
114
104
 
115
105
  export function parsePseudoBin(bytes: Buffer, offset: number) {
116
- const lineCount = longToNumber(
117
- Long.fromBytesLE(
106
+ return {
107
+ lineCount: Long.fromBytesLE(
118
108
  Array.prototype.slice.call(bytes, offset, offset + 8),
119
109
  true,
120
- ),
121
- )
122
- return { lineCount }
110
+ ).toNumber(),
111
+ }
123
112
  }
124
113
 
125
114
  export function findFirstData(