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 2.2.0 to 2.2.1

3

dist/index.d.ts

@@ -9,2 +9,3 @@ import _parse from './parse';

import _User from './user';
import _Episode from './episode';
import _SpotifyUri from './spotify-uri';

@@ -29,2 +30,4 @@ declare function parseSpotifyUri(uri: string | _SpotifyUri): parseSpotifyUri.ParsedSpotifyUri;

const User: typeof _User;
type Episode = _Episode;
const Episode: typeof _Episode;
type ParsedSpotifyUri = Search | Local | Playlist | Track | Artist | Album | User;

@@ -31,0 +34,0 @@ const parse: typeof _parse;

@@ -13,2 +13,3 @@ "use strict";

const user_1 = __importDefault(require("./user"));
const episode_1 = __importDefault(require("./episode"));
const spotify_uri_1 = __importDefault(require("./spotify-uri"));

@@ -27,2 +28,3 @@ function parseSpotifyUri(uri) {

parseSpotifyUri.User = user_1.default;
parseSpotifyUri.Episode = episode_1.default;
parseSpotifyUri.parse = parse_1.default;

@@ -29,0 +31,0 @@ function formatURI(input) {

10

package.json

@@ -5,3 +5,3 @@ {

"homepage": "https://github.com/TooTallNate/spotify-uri#readme",
"version": "2.2.0",
"version": "2.2.1",
"main": "./dist/index.js",

@@ -76,11 +76,11 @@ "author": {

],
"license": "MIT",
"typings": "./dist/index.d.ts",
"scripts": {
"build": "tsc",
"prebuild": "rimraf dist",
"prepublishOnly": "npm run build",
"test": "mocha",
"test-lint": "eslint src --ext .js,.ts"
},
"license": "MIT",
"typings": "./dist/index.d.ts"
}
"readme": "spotify-uri\n===========\n### Parse the various Spotify URI formats into Objects and back\n[![Build Status](https://github.com/TooTallNate/spotify-uri/workflows/Node%20CI/badge.svg)](https://github.com/TooTallNate/spotify-uri/actions?workflow=Node+CI)\n\nSpotify URIs get passed around in a variety of flavors. This module parses them\ninto a JavaScript object so you can work with them further. You can also convert\nthem back into Spotify URIs or HTTP URLs.\n\n\nInstallation\n------------\n\nInstall for node.js or browserify using `npm`:\n\n``` bash\n$ npm install spotify-uri\n```\n\n\nExample\n-------\n\n``` javascript\nvar spotifyUri = require('spotify-uri');\nvar parsed, uri;\n\n// parse Spotify URIs or HTTP URLs into JavaScipt metadata Objects:\n\nparsed = spotifyUri.parse('spotify:track:3GU4cxkfdc3lIp9pFEMMmw');\nconsole.log(parsed);\n// { uri: 'spotify:track:3GU4cxkfdc3lIp9pFEMMmw',\n// type: 'track',\n// id: '3GU4cxkfdc3lIp9pFEMMmw' }\n\nparsed = spotifyUri.parse('http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN');\nconsole.log(parsed);\n// { uri: 'http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN',\n// type: 'track',\n// id: '1pKYYY0dkg23sQQXi0Q5zN' }\n\n\n// you can also format the parsed objects back into a URI or HTTP URL:\n\nuri = spotifyUri.formatURI(parsed);\nconsole.log(uri);\n// 'spotify:track:1pKYYY0dkg23sQQXi0Q5zN'\n\nuri = spotifyUri.formatOpenURL(parsed);\nconsole.log(uri);\n// 'http://open.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN'\n\nuri = spotifyUri.formatPlayURL(parsed);\nconsole.log(uri);\n// 'https://play.spotify.com/track/1pKYYY0dkg23sQQXi0Q5zN'\n\nuri = spotifyUri.formatEmbedURL(parsed);\nconsole.log(uri);\n// 'https://embed.spotify.com/?uri=spotify:track:1pKYYY0dkg23sQQXi0Q5zN'\n```\n\nSee the [test cases](./test) for some more examples of Spotify URIs.\n\n\n## API\n\n### .parse(String uri) → Object\n\nParses a Spotify URI or a Spotify HTTP(s) URL into an Object. The specific\nproperties set on the returned Object depend on the \"type\" of `uri` that gets\npassed in. The different \"types\" are listed below:\n\n### .formatURI(Object parsedUri) → String\n\nFormats a parsed URI Object back into a Spotify URI. For example:\n\n``` js\nvar parsed = spotifyUri.parse('https://play.spotify.com/track/3GU4cxkfdc3lIp9pFEMMmw');\nvar uri = spotifyUri.formatURI(parsed);\nconsole.log(uri);\n// 'spotify:track:3GU4cxkfdc3lIp9pFEMMmw'\n```\n\n### .formatOpenURL(Object parsedUri) → String\n\nFormats a parsed URI Object back into a Spotify HTTP \"open\" URL. For example:\n\n``` js\nvar parsed = spotifyUri.parse('spotify:track:3c1zC1Ma3987kQcHQfcG0Q');\nvar uri = spotifyUri.formatOpenURL(parsed);\nconsole.log(uri);\n// 'http://open.spotify.com/track/3c1zC1Ma3987kQcHQfcG0Q'\n```\n\n### .formatPlayURL(Object parsedUri) → String\n\nFormats a parsed URI Object back into a Spotify HTTPS \"play\" URL. For example:\n\n``` js\nvar parsed = spotifyUri.parse('spotify:track:4Jgp57InfWE4MxJLfheNVz');\nvar uri = spotifyUri.formatPlayURL(parsed);\nconsole.log(uri);\n// 'https://play.spotify.com/track/4Jgp57InfWE4MxJLfheNVz'\n```\n\n### .formatEmbedURL(Object parsedUri) → String\n\nFormats a parsed URI Object back into a Spotify HTTPS \"embed\" URL. For example:\n\n``` js\nvar parsed = spotifyUri.parse('spotify:track:6JmI8SpUHoQ4yveHLjTrko');\nvar uri = spotifyUri.formatEmbedURL(parsed);\nconsole.log(uri);\n// 'https://embed.spotify.com/?uri=spotify:track:6JmI8SpUHoQ4yveHLjTrko'\n```\n\n\n## License\n\nMIT\n"
}

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