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

mohamed-spotify-wrapper

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mohamed-spotify-wrapper - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

177

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() {

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

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

@@ -82,2 +82,9 @@ /************************************************************************/

module.exports = __webpack_require__(1).default;
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";

@@ -89,56 +96,56 @@

});
/* global fetch */
var wrapperFetch = exports.wrapperFetch = function wrapperFetch(url) {
var headers = {
'Accept': 'application/json', // eslint-disable-line
'Content-Type': 'application/json', // eslint-disable-line
'Authorization': 'Bearer BQAuS2Snx2Fg7SF0evqwcOLi_fwzedj1FnrNS0ov7X0I0Txt_Wwx_LBX9YCECcntUL48Jc7IUanWto1kMqaECRyDMZ0tBscNAf_WRTaqfU21XaVHBazJMWAnyF0pF4e8n3RVKIaiOK0s9xo1rmPnXXpMKA' // eslint-disable-line
};
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 options = { headers: headers };
return fetch(url, options);
};
var toJSON = exports.toJSON = function toJSON(data) {
return data.json();
};
var _search = __webpack_require__(2);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
var _search2 = _interopRequireDefault(_search);
"use strict";
var _album = __webpack_require__(3);
var _album2 = _interopRequireDefault(_album);
Object.defineProperty(exports, "__esModule", {
value: true
});
var API_URL = 'https://api.spotify.com/v1';
exports.default = API_URL;
var _config = __webpack_require__(4);
/***/ }),
/* 2 */
/***/ (function(module, exports, __webpack_require__) {
var _config2 = _interopRequireDefault(_config);
"use strict";
var _utils = __webpack_require__(5);
var _utils2 = _interopRequireDefault(_utils);
var _search = __webpack_require__(3);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _album = __webpack_require__(4);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
module.exports = {
search: _search.search,
searchArtists: _search.searchArtists,
searchAlbums: _search.searchAlbums,
searchTracks: _search.searchTracks,
searchPlaylists: _search.searchPlaylists,
getAlbum: _album.getAlbum,
getAlbums: _album.getAlbums,
getAlbumTracks: _album.getAlbumTracks
};
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;
/***/ }),
/* 3 */
/* 2 */
/***/ (function(module, exports, __webpack_require__) {

@@ -152,28 +159,41 @@

});
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);
}
function search() {
return {
artists: searcher.bind(this, 'artist'),
albums: searcher.bind(this, 'album'),
tracks: searcher.bind(this, 'track'),
playlists: searcher.bind(this, 'playlist')
};
}
var _utils = __webpack_require__(0);
/***/ }),
/* 3 */
/***/ (function(module, exports, __webpack_require__) {
var _config = __webpack_require__(1);
"use strict";
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = album;
function album() {
var _this = this;
var search = exports.search = function search(query, type) {
var url = _config2.default + '/search?q=' + query + '&type=' + type;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
var searchArtists = exports.searchArtists = function searchArtists(query) {
return search(query, 'artist');
};
var searchAlbums = exports.searchAlbums = function searchAlbums(query) {
return search(query, 'album');
};
var searchTracks = exports.searchTracks = function searchTracks(query) {
return search(query, 'track');
};
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) {
return search(query, 'playlist');
};
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");
}
};
}

@@ -190,27 +210,20 @@ /***/ }),

});
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined;
var API_URL = 'https://api.spotify.com/v1';
exports.default = API_URL;
var _utils = __webpack_require__(0);
/***/ }),
/* 5 */
/***/ (function(module, exports, __webpack_require__) {
var _config = __webpack_require__(1);
"use strict";
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getAlbum = exports.getAlbum = function getAlbum(id) {
var url = _config2.default + '/albums/' + id;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
Object.defineProperty(exports, "__esModule", {
value: true
});
var toJSON = function toJSON(data) {
return data.json();
};
exports.default = toJSON;
var getAlbums = exports.getAlbums = function getAlbums(ids) {
var url = _config2.default + '/albums?ids=' + ids;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) {
var url = _config2.default + '/albums/' + id + '/tracks';
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
/***/ })

@@ -217,0 +230,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(n){if(r[n])return r[n].exports;var s=r[n]={i:n,l:!1,exports:{}};return e[n].call(s.exports,s,s.exports,t),s.l=!0,s.exports}var r={};return t.m=e,t.c=r,t.d=function(e,r,n){t.o(e,r)||Object.defineProperty(e,r,{configurable:!1,enumerable:!0,get:n})},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=2)}([function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.wrapperFetch=function(e){var t={Accept:"application/json","Content-Type":"application/json",Authorization:"Bearer BQAuS2Snx2Fg7SF0evqwcOLi_fwzedj1FnrNS0ov7X0I0Txt_Wwx_LBX9YCECcntUL48Jc7IUanWto1kMqaECRyDMZ0tBscNAf_WRTaqfU21XaVHBazJMWAnyF0pF4e8n3RVKIaiOK0s9xo1rmPnXXpMKA"},r={headers:t};return fetch(e,r)},t.toJSON=function(e){return e.json()}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.default="https://api.spotify.com/v1"},function(e,t,r){"use strict";var n=r(3),s=r(4);e.exports={search:n.search,searchArtists:n.searchArtists,searchAlbums:n.searchAlbums,searchTracks:n.searchTracks,searchPlaylists:n.searchPlaylists,getAlbum:s.getAlbum,getAlbums:s.getAlbums,getAlbumTracks:s.getAlbumTracks}},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 n=r(0),s=r(1),u=function(e){return e&&e.__esModule?e:{default:e}}(s),a=t.search=function(e,t){var r=u.default+"/search?q="+e+"&type="+t;return(0,n.wrapperFetch)(r).then(n.toJSON)};t.searchArtists=function(e){return a(e,"artist")},t.searchAlbums=function(e){return a(e,"album")},t.searchTracks=function(e){return a(e,"track")},t.searchPlaylists=function(e){return a(e,"playlist")}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getAlbumTracks=t.getAlbums=t.getAlbum=void 0;var n=r(0),s=r(1),u=function(e){return e&&e.__esModule?e:{default:e}}(s);t.getAlbum=function(e){var t=u.default+"/albums/"+e;return(0,n.wrapperFetch)(t).then(n.toJSON)},t.getAlbums=function(e){var t=u.default+"/albums?ids="+e;return(0,n.wrapperFetch)(t).then(n.toJSON)},t.getAlbumTracks=function(e){var t=u.default+"/albums/"+e+"/tracks";return(0,n.wrapperFetch)(t).then(n.toJSON)}}])});
!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.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=0)}([function(t,e,n){t.exports=n(1).default},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(2),s=r(o),a=n(3),f=r(a),c=n(4),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){"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";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";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,25 +6,17 @@ Object.defineProperty(exports, "__esModule", {

});
exports.getAlbumTracks = exports.getAlbums = exports.getAlbum = undefined;
exports.default = album;
function album() {
var _this = this;
var _utils = require('./utils');
var _config = require('./config');
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getAlbum = exports.getAlbum = function getAlbum(id) {
var url = _config2.default + '/albums/' + id;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
var getAlbums = exports.getAlbums = function getAlbums(ids) {
var url = _config2.default + '/albums?ids=' + ids;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
var getAlbumTracks = exports.getAlbumTracks = function getAlbumTracks(id) {
var url = _config2.default + '/albums/' + id + '/tracks';
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
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
});
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,
searchTracks: _search.searchTracks,
searchPlaylists: _search.searchPlaylists,
getAlbum: _album.getAlbum,
getAlbums: _album.getAlbums,
getAlbumTracks: _album.getAlbumTracks
};
var _album2 = _interopRequireDefault(_album);
var _config = require('../src/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,13 @@ 'use strict';

});
exports.searchPlaylists = exports.searchTracks = exports.searchAlbums = exports.searchArtists = exports.search = undefined;
var _utils = require('./utils');
var _config = require('./config');
var _config2 = _interopRequireDefault(_config);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var search = exports.search = function search(query, type) {
var url = _config2.default + '/search?q=' + query + '&type=' + type;
return (0, _utils.wrapperFetch)(url).then(_utils.toJSON);
};
var searchArtists = exports.searchArtists = function searchArtists(query) {
return search(query, 'artist');
};
var searchAlbums = exports.searchAlbums = function searchAlbums(query) {
return search(query, 'album');
};
var searchTracks = exports.searchTracks = function searchTracks(query) {
return search(query, 'track');
};
var searchPlaylists = exports.searchPlaylists = function searchPlaylists(query) {
return search(query, 'playlist');
};
exports.default = search;
function searcher(type, query) {
return this.request(this.apiURL + '/search?q=' + query + '&type=' + type);
}
function search() {
return {
artists: searcher.bind(this, 'artist'),
albums: searcher.bind(this, 'album'),
tracks: searcher.bind(this, 'track'),
playlists: searcher.bind(this, 'playlist')
};
}

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

'use strict';
"use strict";

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

});
/* global fetch */
var wrapperFetch = exports.wrapperFetch = function wrapperFetch(url) {
var headers = {
'Accept': 'application/json', // eslint-disable-line
'Content-Type': 'application/json', // eslint-disable-line
'Authorization': 'Bearer BQAuS2Snx2Fg7SF0evqwcOLi_fwzedj1FnrNS0ov7X0I0Txt_Wwx_LBX9YCECcntUL48Jc7IUanWto1kMqaECRyDMZ0tBscNAf_WRTaqfU21XaVHBazJMWAnyF0pF4e8n3RVKIaiOK0s9xo1rmPnXXpMKA' // eslint-disable-line
};
var options = { headers: headers };
return fetch(url, options);
var toJSON = function toJSON(data) {
return data.json();
};
var toJSON = exports.toJSON = function toJSON(data) {
return data.json();
};
exports.default = toJSON;
{
"name": "mohamed-spotify-wrapper",
"version": "1.0.3",
"version": "1.0.4",
"description": "The wrapper for web api of spotify",

@@ -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