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

spotify-wrapper-wj

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spotify-wrapper-wj - npm Package Compare versions

Comparing version 1.0.2 to 1.0.5

172

dist/spotify-wrapper.umd.js

@@ -7,5 +7,5 @@ (function webpackUniversalModuleDefinition(root, factory) {

else if(typeof exports === 'object')
exports["spotifyWrapper"] = factory();
exports["SpotifyWrapper"] = factory();
else
root["spotifyWrapper"] = factory();
root["SpotifyWrapper"] = factory();
})(this, function() {

@@ -77,3 +77,3 @@ return /******/ (function(modules) { // webpackBootstrap

/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 4);
/******/ return __webpack_require__(__webpack_require__.s = 1);
/******/ })

@@ -89,14 +89,57 @@ /************************************************************************/

Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
var TOKEN_API = 'BQDU6cKTjsGyi54v5mr84CndPs7TMl_eghiJvo0qiH96bJiXGTYzCTQHDLAf5uWoIW4gs3sys54PpY7-gy97yU4NHeKZN0OOfsQ087Okbbfh5bmei1uSfzzlLQ3A9WAHKL9DscyDYgdJnOCqtt8C5Ln1AFqkO7DSzg';
var API_URL = exports.API_URL = 'https://api.spotify.com/v1';
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global fetch */
var HEADERS = exports.HEADERS = {
headers: {
'Authorization': '\'Bearer ' + TOKEN_API + '\''
var _search = __webpack_require__(4);
var _search2 = _interopRequireDefault(_search);
var _album = __webpack_require__(2);
var _album2 = _interopRequireDefault(_album);
var _config = __webpack_require__(3);
var _config2 = _interopRequireDefault(_config);
var _utils = __webpack_require__(5);
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SpotifyWrapper = function () {
function SpotifyWrapper(options) {
_classCallCheck(this, SpotifyWrapper);
this.apiURL = options.apiURL || _config2.default;
this.token = options.token;
this.album = _album2.default.bind(this)();
this.search = _search2.default.bind(this)();
}
_createClass(SpotifyWrapper, [{
key: 'request',
value: function request(url) {
var headers = {
headers: {
Authorization: '\'Bearer ' + this.token + '\''
}
};
return fetch(url, headers).then(_utils2.default);
}
};
}]);
return SpotifyWrapper;
}();
exports.default = SpotifyWrapper;
/***/ }),

@@ -106,13 +149,4 @@ /* 1 */

"use strict";
module.exports = __webpack_require__(0).default;
Object.defineProperty(exports, "__esModule", {
value: true
});
var toJSON = function toJSON(data) {
return data.json();
};
exports.default = toJSON;
/***/ }),

@@ -128,25 +162,19 @@ /* 2 */

});
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined;
exports.default = album;
function album() {
var _this = this;
var _config = __webpack_require__(0);
return {
getAlbum: function getAlbum(id) {
return _this.request(_this.apiURL + "/albums/" + id);
},
getAlbums: function getAlbums(ids) {
return _this.request(_this.apiURL + "/albums/?ids=" + ids);
},
getTracks: function getTracks(id) {
return _this.request(_this.apiURL + "/albums/" + id + "/tracks");
}
};
}
var _utils = __webpack_require__(1);
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* global fetch */
var getAlbum = exports.getAlbum = function getAlbum(id) {
return fetch(_config.API_URL + '/albums/' + id, _config.HEADERS).then(_utils2.default);
};
var getAlbums = exports.getAlbums = function getAlbums(ids) {
return fetch(_config.API_URL + '/albums/?ids=' + ids, _config.HEADERS).then(_utils2.default);
};
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) {
return fetch(_config.API_URL + '/albums/' + id + '/tracks', _config.HEADERS).then(_utils2.default);
};
/***/ }),

@@ -162,31 +190,31 @@ /* 3 */

});
exports.searchPlaylists = exports.searchTracks = exports.searchAlbums = exports.searchArtists = exports.search = undefined;
var API_URL = 'https://api.spotify.com/v1';
exports.default = API_URL;
var _config = __webpack_require__(0);
/***/ }),
/* 4 */
/***/ (function(module, exports, __webpack_require__) {
var _utils = __webpack_require__(1);
"use strict";
/* global fetch */
var search = exports.search = function search(query, type) {
return fetch(_config.API_URL + '/search?q=' + query + '&type=' + type, _config.HEADERS).then(_utils.toJSON);
};
var searchArtists = exports.searchArtists = function searchArtists(query) {
return search(query, 'artist', _config.HEADERS);
};
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = search;
function searcher(type, query) {
return this.request(this.apiURL + '/search?q=' + query + '&type=' + type);
}
var searchAlbums = exports.searchAlbums = function searchAlbums(query) {
return search(query, 'album', _config.HEADERS);
};
function search() {
return {
artists: searcher.bind(this, 'artist'),
albums: searcher.bind(this, 'album'),
tracks: searcher.bind(this, 'track'),
playlists: searcher.bind(this, 'playlist')
};
}
var searchTracks = exports.searchTracks = function searchTracks(query) {
return search(query, 'track', _config.HEADERS);
};
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) {
return search(query, 'playlist', _config.HEADERS);
};
/***/ }),
/* 4 */
/* 5 */
/***/ (function(module, exports, __webpack_require__) {

@@ -197,15 +225,9 @@

var _search = __webpack_require__(3);
var _album = __webpack_require__(2);
module.exports = {
search: _search.search,
searchArtists: _search.searchArtists,
searchAlbums: _search.searchAlbums,
searchPlaylists: _search.searchPlaylists,
getAlbum: _album.getAlbum,
getAlbums: _album.getAlbums,
getAlbumTracks: _album.getAlbumTracks
Object.defineProperty(exports, "__esModule", {
value: true
});
var toJSON = function toJSON(data) {
return data.json();
};
exports.default = toJSON;

@@ -212,0 +234,0 @@ /***/ })

@@ -1,2 +0,2 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.spotifyWrapper=t():e.spotifyWrapper=t()}(this,function(){return function(e){function t(s){if(r[s])return r[s].exports;var u=r[s]={i:s,l:!1,exports:{}};return e[s].call(u.exports,u,u.exports,t),u.l=!0,u.exports}var r={};return t.m=e,t.c=r,t.i=function(e){return e},t.d=function(e,r,s){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:s})},t.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,"a",r),r},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=4)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.API_URL="https://api.spotify.com/v1",t.HEADERS={headers:{Authorization:"'Bearer BQDU6cKTjsGyi54v5mr84CndPs7TMl_eghiJvo0qiH96bJiXGTYzCTQHDLAf5uWoIW4gs3sys54PpY7-gy97yU4NHeKZN0OOfsQ087Okbbfh5bmei1uSfzzlLQ3A9WAHKL9DscyDYgdJnOCqtt8C5Ln1AFqkO7DSzg'"}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var s=function(e){return e.json()};t.default=s},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAlbumTracks=t.getAlbums=t.getAlbum=void 0;var s=r(0),u=r(1),n=function(e){return e&&e.__esModule?e:{default:e}}(u);t.getAlbum=function(e){return fetch(s.API_URL+"/albums/"+e,s.HEADERS).then(n.default)},t.getAlbums=function(e){return fetch(s.API_URL+"/albums/?ids="+e,s.HEADERS).then(n.default)},t.getAlbumTracks=function(e){return fetch(s.API_URL+"/albums/"+e+"/tracks",s.HEADERS).then(n.default)}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.searchPlaylists=t.searchTracks=t.searchAlbums=t.searchArtists=t.search=void 0;var s=r(0),u=r(1),n=t.search=function(e,t){return fetch(s.API_URL+"/search?q="+e+"&type="+t,s.HEADERS).then(u.toJSON)};t.searchArtists=function(e){return n(e,"artist",s.HEADERS)},t.searchAlbums=function(e){return n(e,"album",s.HEADERS)},t.searchTracks=function(e){return n(e,"track",s.HEADERS)},t.searchPlaylists=function(e){return n(e,"playlist",s.HEADERS)}},function(e,t,r){"use strict";var s=r(3),u=r(2);e.exports={search:s.search,searchArtists:s.searchArtists,searchAlbums:s.searchAlbums,searchPlaylists:s.searchPlaylists,getAlbum:u.getAlbum,getAlbums:u.getAlbums,getAlbumTracks:u.getAlbumTracks}}])});
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.SpotifyWrapper=e():t.SpotifyWrapper=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var u=n[r]={i:r,l:!1,exports:{}};return t[r].call(u.exports,u,u.exports,e),u.l=!0,u.exports}var n={};return e.m=t,e.c=n,e.i=function(t){return t},e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="",e(e.s=1)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function u(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=n(4),s=r(o),a=n(2),f=r(a),c=n(3),l=r(c),p=n(5),d=r(p),b=function(){function t(e){u(this,t),this.apiURL=e.apiURL||l.default,this.token=e.token,this.album=f.default.bind(this)(),this.search=s.default.bind(this)()}return i(t,[{key:"request",value:function(t){var e={headers:{Authorization:"'Bearer "+this.token+"'"}};return fetch(t,e).then(d.default)}}]),t}();e.default=b},function(t,e,n){t.exports=n(0).default},function(t,e,n){"use strict";function r(){var t=this;return{getAlbum:function(e){return t.request(t.apiURL+"/albums/"+e)},getAlbums:function(e){return t.request(t.apiURL+"/albums/?ids="+e)},getTracks:function(e){return t.request(t.apiURL+"/albums/"+e+"/tracks")}}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.default="https://api.spotify.com/v1"},function(t,e,n){"use strict";function r(t,e){return this.request(this.apiURL+"/search?q="+e+"&type="+t)}function u(){return{artists:r.bind(this,"artist"),albums:r.bind(this,"album"),tracks:r.bind(this,"track"),playlists:r.bind(this,"playlist")}}Object.defineProperty(e,"__esModule",{value:!0}),e.default=u},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(t){return t.json()};e.default=r}])});
//# sourceMappingURL=spotify-wrapper.umd.min.js.map

@@ -1,2 +0,2 @@

'use strict';
"use strict";

@@ -6,23 +6,17 @@ Object.defineProperty(exports, "__esModule", {

});
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined;
exports.default = album;
function album() {
var _this = this;
var _config = require('./config');
var _utils = require('./utils');
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/* global fetch */
var getAlbum = exports.getAlbum = function getAlbum(id) {
return fetch(_config.API_URL + '/albums/' + id, _config.HEADERS).then(_utils2.default);
};
var getAlbums = exports.getAlbums = function getAlbums(ids) {
return fetch(_config.API_URL + '/albums/?ids=' + ids, _config.HEADERS).then(_utils2.default);
};
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) {
return fetch(_config.API_URL + '/albums/' + id + '/tracks', _config.HEADERS).then(_utils2.default);
};
return {
getAlbum: function getAlbum(id) {
return _this.request(_this.apiURL + "/albums/" + id);
},
getAlbums: function getAlbums(ids) {
return _this.request(_this.apiURL + "/albums/?ids=" + ids);
},
getTracks: function getTracks(id) {
return _this.request(_this.apiURL + "/albums/" + id + "/tracks");
}
};
}
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
value: true
});
var TOKEN_API = 'BQDU6cKTjsGyi54v5mr84CndPs7TMl_eghiJvo0qiH96bJiXGTYzCTQHDLAf5uWoIW4gs3sys54PpY7-gy97yU4NHeKZN0OOfsQ087Okbbfh5bmei1uSfzzlLQ3A9WAHKL9DscyDYgdJnOCqtt8C5Ln1AFqkO7DSzg';
var API_URL = exports.API_URL = 'https://api.spotify.com/v1';
var HEADERS = exports.HEADERS = {
headers: {
'Authorization': '\'Bearer ' + TOKEN_API + '\''
}
};
var API_URL = 'https://api.spotify.com/v1';
exports.default = API_URL;
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /* global fetch */
var _search = require('./search');
var _search2 = _interopRequireDefault(_search);
var _album = require('./album');
module.exports = {
search: _search.search,
searchArtists: _search.searchArtists,
searchAlbums: _search.searchAlbums,
searchPlaylists: _search.searchPlaylists,
getAlbum: _album.getAlbum,
getAlbums: _album.getAlbums,
getAlbumTracks: _album.getAlbumTracks
};
var _album2 = _interopRequireDefault(_album);
var _config = require('./config');
var _config2 = _interopRequireDefault(_config);
var _utils = require('./utils');
var _utils2 = _interopRequireDefault(_utils);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
var SpotifyWrapper = function () {
function SpotifyWrapper(options) {
_classCallCheck(this, SpotifyWrapper);
this.apiURL = options.apiURL || _config2.default;
this.token = options.token;
this.album = _album2.default.bind(this)();
this.search = _search2.default.bind(this)();
}
_createClass(SpotifyWrapper, [{
key: 'request',
value: function request(url) {
var headers = {
headers: {
Authorization: '\'Bearer ' + this.token + '\''
}
};
return fetch(url, headers).then(_utils2.default);
}
}]);
return SpotifyWrapper;
}();
exports.default = SpotifyWrapper;

@@ -6,27 +6,14 @@ 'use strict';

});
exports.searchPlaylists = exports.searchTracks = exports.searchAlbums = exports.searchArtists = exports.search = undefined;
exports.default = search;
function searcher(type, query) {
return this.request(this.apiURL + '/search?q=' + query + '&type=' + type);
}
var _config = require('./config');
var _utils = require('./utils');
/* global fetch */
var search = exports.search = function search(query, type) {
return fetch(_config.API_URL + '/search?q=' + query + '&type=' + type, _config.HEADERS).then(_utils.toJSON);
};
var searchArtists = exports.searchArtists = function searchArtists(query) {
return search(query, 'artist', _config.HEADERS);
};
var searchAlbums = exports.searchAlbums = function searchAlbums(query) {
return search(query, 'album', _config.HEADERS);
};
var searchTracks = exports.searchTracks = function searchTracks(query) {
return search(query, 'track', _config.HEADERS);
};
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) {
return search(query, 'playlist', _config.HEADERS);
};
function search() {
return {
artists: searcher.bind(this, 'artist'),
albums: searcher.bind(this, 'album'),
tracks: searcher.bind(this, 'track'),
playlists: searcher.bind(this, 'playlist')
};
}
{
"name": "spotify-wrapper-wj",
"version": "1.0.2",
"version": "1.0.5",
"description": "A wrapper to work with the Spotify Web API",

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

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