Skip to content

Commit

Permalink
Update devDeps
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Aug 30, 2024
1 parent d90afd4 commit 79806bf
Show file tree
Hide file tree
Showing 4 changed files with 155 additions and 172 deletions.
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
"src"
],
"scripts": {
"test": "vitest run",
"coverage": "npm test -- --coverage",
"lint": "eslint --report-unused-disable-directives --max-warnings 0 src test",
"test": "vitest",
"lint": "eslint --report-unused-disable-directives --max-warnings 0",
"clean": "rimraf dist esm",
"build:esm": "tsc --target es2018 --outDir esm",
"build:es5": "tsc --target es2015 --module commonjs --outDir dist",
"build": "npm run build:esm && npm run build:es5",
"prebuild": "npm run clean && npm run lint",
"preversion": "npm run lint && npm test && npm run build",
"preversion": "npm run lint && npm test run && npm run build",
"version": "standard-changelog && git add CHANGELOG.md",
"postversion": "git push --follow-tags"
},
Expand All @@ -43,7 +42,6 @@
"@gmod/bgzf-filehandle": "^1.4.4",
"crc": "^4.3.2",
"generic-filehandle": "^3.0.0",
"long": "^4.0.0",
"quick-lru": "^4.0.0"
},
"devDependencies": {
Expand Down
21 changes: 3 additions & 18 deletions src/util.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
import Long from 'long'
import Chunk from './chunk'
import VirtualOffset from './virtualOffset'

export function timeout(ms: number) {
return new Promise(resolve => setTimeout(resolve, ms))
}

export function longToNumber(long: Long) {
if (
long.greaterThan(Number.MAX_SAFE_INTEGER) ||
long.lessThan(Number.MIN_SAFE_INTEGER)
) {
throw new Error('integer overflow')
}
return long.toNumber()
}

/**
* Properly check if the given AbortSignal is aborted.
* Per the standard, if the signal reads as aborted,
Expand Down Expand Up @@ -113,13 +102,9 @@ export function optimizeChunks(chunks: Chunk[], lowest?: VirtualOffset) {
}

export function parsePseudoBin(bytes: Buffer, offset: number) {
const lineCount = longToNumber(
Long.fromBytesLE(
Array.prototype.slice.call(bytes, offset, offset + 8),
true,
),
)
return { lineCount }
return {
lineCount: Number(bytes.readBigInt64LE(offset)),
}
}

export function findFirstData(
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"include": ["src"],
"compilerOptions": {
"outDir": "dist",
"target":"es2018",
"target": "es2018",
"types": ["node"],
"lib": ["dom", "esnext"],
"declaration": true,
Expand Down
Loading

0 comments on commit 79806bf

Please sign in to comment.