Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

magnet-uri

Package Overview
Dependencies
Maintainers
7
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

magnet-uri - npm Package Compare versions

Comparing version 5.4.0 to 6.0.0

30

index.js

@@ -64,9 +64,2 @@ /*! magnet-uri. MIT License. WebTorrent LLC <https://webtorrent.io/opensource> */

if (result['x.pe']) {
// remove duplicates and convert to array
result['x.pe'] = Array.isArray(result['x.pe'])
? Array.from(new Set(result['x.pe']))
: [result['x.pe']]
}
// Convenience properties for parity with `parse-torrent-file` module

@@ -89,7 +82,7 @@ let m

if (result.kt) result.keywords = result.kt
if (result['x.pe']) result.peerAddresses = result['x.pe']
if (typeof result.tr === 'string') result.announce = [result.tr]
else if (Array.isArray(result.tr)) result.announce = result.tr
else result.announce = []
result.announce = []
if (typeof result.tr === 'string' || Array.isArray(result.tr)) {
result.announce = result.announce.concat(result.tr)
}

@@ -104,12 +97,12 @@ result.urlList = []

result.peerAddresses = []
if (typeof result['x.pe'] === 'string' || Array.isArray(result['x.pe'])) {
result.peerAddresses = result.peerAddresses.concat(result['x.pe'])
}
// remove duplicates by converting to Set and back
result.announce = Array.from(new Set(result.announce))
result.urlList = Array.from(new Set(result.urlList))
result.peerAddresses = Array.from(new Set(result.peerAddresses))
// convert x.pe into two level object
if (result['x.pe']) {
result.x = { pe: result['x.pe'] }
delete result['x.pe']
}
return result

@@ -134,5 +127,2 @@ }

// translate x.pe for processing
if (obj.x && obj.x.pe) obj['x.pe'] = obj.x.pe
let result = 'magnet:?'

@@ -139,0 +129,0 @@ Object.keys(obj)

{
"name": "magnet-uri",
"description": "Parse a magnet URI and return an object of keys/values",
"version": "5.4.0",
"version": "6.0.0",
"author": {

@@ -6,0 +6,0 @@ "name": "WebTorrent LLC",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc