Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: imports #63

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*! magnet-uri. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */
import base32 from 'thirty-two'
import bep53Range from 'bep53-range'
import { parse, compose } from 'bep53-range'

/**
* Parse a magnet URI and return an object of keys/values
Expand Down Expand Up @@ -43,7 +43,7 @@ function magnetURIDecode (uri) {
if (key === 'ix') val = Number(val)

// bep53
if (key === 'so') val = bep53Range.parse(decodeURIComponent(val).split(','))
if (key === 'so') val = parse(decodeURIComponent(val).split(','))

// If there are repeated parameters, return an array of values
if (result[key]) {
Expand Down Expand Up @@ -166,7 +166,7 @@ function magnetURIEncode (obj) {
if (key === 'kt' && j > 0) result += `+${val}`
else result += `${key}=${val}`
})
if (key === 'so') result += `${key}=${bep53Range.compose(values)}`
if (key === 'so') result += `${key}=${compose(values)}`
})

return result
Expand Down