Skip to content

Commit

Permalink
fix: imports (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
ThaUnknown authored Jan 25, 2023
1 parent 9ebb4cf commit ce7861e
Showing 1 changed file with 3 additions and 3 deletions.
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

0 comments on commit ce7861e

Please sign in to comment.