New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

spotify-uri

Package Overview
Dependencies
Maintainers
2
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spotify-uri - npm Package Compare versions

Comparing version 4.0.1 to 4.1.0

2

dist/index.d.ts

@@ -18,3 +18,3 @@ declare enum SpotifyTypes {

uri: string;
constructor(uri: string, id: string);
constructor(uri: string, id: string, type: SpotifyTypes);
static is(v: any): v is SpotifyUri;

@@ -21,0 +21,0 @@ toURI(): string;

@@ -40,5 +40,2 @@ "use strict";

// src/parse.ts
var import_url = require("url");
// src/util.ts

@@ -57,6 +54,6 @@ function decode(str) {

uri;
constructor(uri, id) {
constructor(uri, id, type) {
this.uri = uri;
this.id = id;
this.type = this.constructor.name.toLowerCase();
this.type = type;
}

@@ -90,3 +87,3 @@ static is(v) {

constructor(uri, artist, album, track, seconds) {
super(uri, "");
super(uri, "", "local" /* Local */);
this.artist = artist;

@@ -101,6 +98,10 @@ this.album = album;

toURI() {
return `spotify:${this.type}:${encode(this.artist)}:${encode(this.album)}:${encode(this.track)}:${this.seconds}`;
return `spotify:${this.type}:${encode(this.artist)}:${encode(
this.album
)}:${encode(this.track)}:${this.seconds}`;
}
toURL() {
return `/${this.type}/${encode(this.artist)}/${encode(this.album)}/${encode(this.track)}/${this.seconds}`;
return `/${this.type}/${encode(this.artist)}/${encode(this.album)}/${encode(
this.track
)}/${this.seconds}`;
}

@@ -123,3 +124,3 @@ };

constructor(uri, id, user) {
super(uri, id);
super(uri, id, "playlist" /* Playlist */);
if (typeof user === "string") {

@@ -200,7 +201,9 @@ this.user = user;

const uri = SpotifyUri.is(input) ? input.uri : input;
const { protocol, hostname, pathname = "/", searchParams } = new import_url.URL(uri);
const { protocol, hostname, pathname = "/", searchParams } = new URL(uri);
if (hostname === "embed.spotify.com") {
const parsedQs = Object.fromEntries(searchParams);
if (typeof parsedQs.uri !== "string") {
throw new Error("Parsed query string was not valid: " + searchParams.toString());
throw new Error(
"Parsed query string was not valid: " + searchParams.toString()
);
}

@@ -228,3 +231,3 @@ return parse(parsedQs.uri);

if (spotifyType === "search" /* Search */) {
return new Search(uri, decode(parts.slice(2).join(":")));
return new Search(uri, decode(parts.slice(2).join(":")), spotifyType);
}

@@ -250,18 +253,18 @@ if (len >= 3 && spotifyType === "local" /* Local */) {

if (len === 3 && spotifyType === "user" /* User */) {
return new User(uri, decode(parts[2]));
return new User(uri, decode(parts[2]), spotifyType);
}
if (spotifyType === "artist" /* Artist */) {
return new Artist(uri, parts[2]);
return new Artist(uri, parts[2], spotifyType);
}
if (spotifyType === "album" /* Album */) {
return new Album(uri, parts[2]);
return new Album(uri, parts[2], spotifyType);
}
if (spotifyType === "track" /* Track */) {
return new Track(uri, parts[2]);
return new Track(uri, parts[2], spotifyType);
}
if (spotifyType === "episode" /* Episode */) {
return new Episode(uri, parts[2]);
return new Episode(uri, parts[2], spotifyType);
}
if (spotifyType === "show" /* Show */) {
return new Show(uri, parts[2]);
return new Show(uri, parts[2], spotifyType);
}

@@ -268,0 +271,0 @@ throw new TypeError(`Could not determine type for: ${uri}`);

@@ -5,4 +5,10 @@ {

"homepage": "https://github.com/TooTallNate/spotify-uri#readme",
"version": "4.0.1",
"version": "4.1.0",
"types": "./dist/index.d.ts",
"main": "./dist/index.js",
"exports": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"module": "./dist/index.mjs",

@@ -24,2 +30,18 @@ "author": {

{
"name": "PawsOfDestruction",
"email": "74069208+PawsOfDestruction@users.noreply.github.com"
},
{
"name": "Enzo Ferey",
"email": "hello@enzoferey.com"
},
{
"name": "Jacob Morrison",
"email": "jake.morrison24@gmail.com"
},
{
"name": "Lioness100",
"email": "jchickmm2@gmail.com"
},
{
"name": "Karl Sander",

@@ -29,6 +51,2 @@ "email": "kall@kall.ws"

{
"name": "Shem Magnezi",
"email": "smagnezi8@gmail.com"
},
{
"name": "Marwan Zibaoui",

@@ -40,2 +58,6 @@ "email": "marwan.zibaoui@gmail.com"

"email": "omiraculous@gmail.com"
},
{
"name": "Shem Magnezi",
"email": "smagnezi8@gmail.com"
}

@@ -79,8 +101,2 @@ ],

"license": "MIT",
"exports": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
},
"types": "./dist/index.d.ts",
"scripts": {

@@ -87,0 +103,0 @@ "build": "tsup src/index.ts --format esm,cjs --dts",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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