Skip to content

Commit

Permalink
Remove usage of url module
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Mar 18, 2024
1 parent 9021a23 commit b1a3c22
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/io/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,7 @@
import url from 'url'
import { ensureNotNullish } from '../typescript'

Check warning on line 1 in src/io/index.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test on node 20.x and ubuntu-latest

'ensureNotNullish' is defined but never used
import { Filehandle } from '../cramFile/filehandle'
import { LocalFile, RemoteFile } from 'generic-filehandle'

function fromUrl(source: string) {
const { protocol, pathname } = url.parse(source)
if (protocol === 'file:') {
return new LocalFile(unescape(ensureNotNullish(pathname)))
}
return new RemoteFile(source)
}

Check failure on line 5 in src/io/index.ts

View workflow job for this annotation

GitHub Actions / Lint, build, and test on node 20.x and ubuntu-latest

Delete `⏎`
function open(
maybeUrl?: string,
Expand All @@ -20,14 +12,14 @@ function open(
return maybeFilehandle
}
if (maybeUrl) {
return fromUrl(maybeUrl)
return new RemoteFile(maybeUrl)
}
if (maybePath) {
return new LocalFile(maybePath)
}
throw new Error('no url, path, or filehandle provided, cannot open')
}

export { fromUrl, open }
export { open }

export { LocalFile, RemoteFile } from 'generic-filehandle'

0 comments on commit b1a3c22

Please sign in to comment.