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

spotify-uri

Package Overview
Dependencies
Maintainers
1
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 0.1.0 to 0.1.1

2

formatOpenURL.js

@@ -27,3 +27,3 @@

if (parsed.starred) {
// "starred" playlist
// user's "starred" playlist
return base + '/user/' + encode(parsed.user) + '/starred';

@@ -30,0 +30,0 @@ } else if ('playlist' == parsed.type) {

@@ -23,5 +23,20 @@

function formatURI (parsed) {
if ('search' == parsed.type) {
if ('string' == typeof parsed) parsed = parse(parsed);
if (parsed.starred) {
// user's "starred" playlist
return 'spotify:user:' + encode(parsed.user) + ':starred';
} else if ('playlist' == parsed.type) {
// user "playlist"
return 'spotify:user:' + encode(parsed.user) + ':playlist:' + parsed.id;
} else if ('local' == parsed.type) {
// "local" file
return 'spotify:local:' + encode(parsed.artist) +
':' + encode(parsed.album) +
':' + encode(parsed.track) +
':' + parsed.seconds;
} else if ('search' == parsed.type) {
// "search" query
return 'spotify:search:' + encode(parsed.query);
} else {
// artist, album, track
return 'spotify:' + parsed.type + ':' + parsed.id;

@@ -28,0 +43,0 @@ }

@@ -0,1 +1,8 @@

0.1.1 / 2013-09-13
==================
- formatURI: fix the "starred" playlist case (#1)
- formatURI: fix the user "playlist" case (#1)
- formatURI: fix the "local" file case (#1)
0.1.0 / 2013-06-01

@@ -2,0 +9,0 @@ ==================

{
"name": "spotify-uri",
"version": "0.1.0",
"version": "0.1.1",
"description": "Parse the various Spotify URI formats into Objects and back",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -52,2 +52,8 @@

});
it('should parse "user" URLs', function () {
var url = 'http://open.spotify.com/user/tootallnate';
var obj = parse(url);
assert('user' == obj.type);
assert('tootallnate' == obj.id);
});
});

@@ -108,3 +114,3 @@

});
it('should parse "lcoal" track URIs 2', function () {
it('should parse "local" track URIs 2', function () {
var uri = 'spotify:local:::a:6';

@@ -156,2 +162,23 @@ var obj = parse(uri);

});
it('should format "starred" playlist open URLs', function () {
var url = 'http://open.spotify.com/user/syknyk/starred';
var obj = parse(url);
var expected = 'spotify:user:syknyk:starred';
var actual = formatURI(obj);
assert(actual == expected);
});
it('should parse "playlist" URIs', function () {
var url = 'spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9';
var obj = parse(url);
var expected = 'spotify:user:syknyk:playlist:0Idyatn0m08Y48tiOovNd9';
var actual = formatURI(obj);
assert(actual == expected);
});
it('should parse "local" file URIs', function () {
var url = 'spotify:local:Flite%2c+Medium+Minus:YouTube:Find+What+You+Love:399';
var obj = parse(url);
var expected = 'spotify:local:Flite%2C+Medium+Minus:YouTube:Find+What+You+Love:399';
var actual = formatURI(obj);
assert(actual == expected);
});
});

@@ -158,0 +185,0 @@

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