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

radio4000-sdk

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

radio4000-sdk - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

29

dist/radio4000-sdk.cjs.js

@@ -45,3 +45,5 @@ 'use strict';

var findTracksByChannel = function (id) {
if (typeof id !== 'string') { throw new Error('Pass a string with a valid channel id'); }
if (typeof id !== 'string') {
throw new TypeError('Pass a string with a valid channel id');
}
var url = "tracks.json?orderBy=\"channel\"&startAt=\"" + id + "\"&endAt=\"" + id + "\"";

@@ -58,2 +60,3 @@ return (

var backup;
var cloudinaryUrl = 'https://res.cloudinary.com/radio4000/image/upload';

@@ -67,22 +70,20 @@ return findChannelBySlug(slug).then(function (channel) {

delete channel.isPremium;
delete channel.tracks;
if (channel.image) {
var url = "https://res.cloudinary.com/radio4000/image/upload/";
channel.imageUrl = url + "/w_500,h_500,c_thumb,fl_lossy/" + (channel.image);
channel.imageUrl = cloudinaryUrl + "/" + (channel.image);
}
// Save current state of backup.
backup = channel;
return channel;
}).then(function (channel) { return findTracksByChannel(channel.id); }).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
}).then(function (channel) {
if (!channel.tracks) { return channel; }
return findTracksByChannel(channel.id).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
});
return backup;
});
return backup;
}).catch(function () {
return Promise.reject(new Error('Could not export your radio, sorry.'));
});
}).catch(function () { return Promise.reject(new Error('Could not backup your radio')); });
}

@@ -89,0 +90,0 @@

@@ -39,3 +39,5 @@ import fetch from 'isomorphic-unfetch';

var findTracksByChannel = function (id) {
if (typeof id !== 'string') { throw new Error('Pass a string with a valid channel id'); }
if (typeof id !== 'string') {
throw new TypeError('Pass a string with a valid channel id');
}
var url = "tracks.json?orderBy=\"channel\"&startAt=\"" + id + "\"&endAt=\"" + id + "\"";

@@ -52,2 +54,3 @@ return (

var backup;
var cloudinaryUrl = 'https://res.cloudinary.com/radio4000/image/upload';

@@ -61,24 +64,22 @@ return findChannelBySlug(slug).then(function (channel) {

delete channel.isPremium;
delete channel.tracks;
if (channel.image) {
var url = "https://res.cloudinary.com/radio4000/image/upload/";
channel.imageUrl = url + "/w_500,h_500,c_thumb,fl_lossy/" + (channel.image);
channel.imageUrl = cloudinaryUrl + "/" + (channel.image);
}
// Save current state of backup.
backup = channel;
return channel;
}).then(function (channel) { return findTracksByChannel(channel.id); }).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
}).then(function (channel) {
if (!channel.tracks) { return channel; }
return findTracksByChannel(channel.id).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
});
return backup;
});
return backup;
}).catch(function () {
return Promise.reject(new Error('Could not export your radio, sorry.'));
});
}).catch(function () { return Promise.reject(new Error('Could not backup your radio')); });
}
export { findChannel, findChannels, findChannelBySlug, findTrack, findTracksByChannel, createBackup };

@@ -45,3 +45,5 @@ (function (global, factory) {

var findTracksByChannel = function (id) {
if (typeof id !== 'string') { throw new Error('Pass a string with a valid channel id'); }
if (typeof id !== 'string') {
throw new TypeError('Pass a string with a valid channel id');
}
var url = "tracks.json?orderBy=\"channel\"&startAt=\"" + id + "\"&endAt=\"" + id + "\"";

@@ -58,2 +60,3 @@ return (

var backup;
var cloudinaryUrl = 'https://res.cloudinary.com/radio4000/image/upload';

@@ -67,22 +70,20 @@ return findChannelBySlug(slug).then(function (channel) {

delete channel.isPremium;
delete channel.tracks;
if (channel.image) {
var url = "https://res.cloudinary.com/radio4000/image/upload/";
channel.imageUrl = url + "/w_500,h_500,c_thumb,fl_lossy/" + (channel.image);
channel.imageUrl = cloudinaryUrl + "/" + (channel.image);
}
// Save current state of backup.
backup = channel;
return channel;
}).then(function (channel) { return findTracksByChannel(channel.id); }).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
}).then(function (channel) {
if (!channel.tracks) { return channel; }
return findTracksByChannel(channel.id).then(function (tracks) {
// Clean up tracks
backup.tracks = tracks.map(function (track) {
delete track.channel;
return track;
});
return backup;
});
return backup;
}).catch(function () {
return Promise.reject(new Error('Could not export your radio, sorry.'));
});
}).catch(function () { return Promise.reject(new Error('Could not backup your radio')); });
}

@@ -89,0 +90,0 @@

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

!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("isomorphic-unfetch")):"function"==typeof define&&define.amd?define(["exports","isomorphic-unfetch"],e):e(n.radio4000Sdk={},n.fetch)}(this,function(n,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=function(n,t){return void 0===t&&(t="https://radio4000.firebaseio.com"),e(t+"/"+n).then(function(n){return n.json()}).then(function(n){if(0===Object.keys(n).length)throw new Error("Not found");return n})},r=function(n,e){return Object.assign(n,{id:e})},o=function(n){return Object.keys(n).map(function(e){return r(n[e],e)})};var i=function(n){return t('channels.json?orderBy="slug"&startAt="'+n+'"&endAt="'+n+'"').then(o).then(function(n){return n[0]})},u=function(n){if("string"!=typeof n)throw new Error("Pass a string with a valid channel id");return t('tracks.json?orderBy="channel"&startAt="'+n+'"&endAt="'+n+'"').then(o).then(function(n){return n.sort(function(n,e){return n.created-e.created})})};n.findChannel=function(n){return t("channels/"+n+".json").then(function(e){return r(e,n)})},n.findChannels=function(n){var e="channels.json";return n&&(e+='?orderBy="created"&limitToFirst='+n),t(e).then(o)},n.findChannelBySlug=i,n.findTrack=function(n){return t("tracks/"+n+".json").then(function(e){return r(e,n)})},n.findTracksByChannel=u,n.createBackup=function(n){if(!n)throw new Error("Can not export channel without a `slug`");var e;return i(n).then(function(n){return delete n.images,delete n.channelPublic,delete n.favoriteChannels,delete n.isFeatured,delete n.isPremium,delete n.tracks,n.image&&(n.imageUrl="https://res.cloudinary.com/radio4000/image/upload//w_500,h_500,c_thumb,fl_lossy/"+n.image),e=n,n}).then(function(n){return u(n.id)}).then(function(n){return e.tracks=n.map(function(n){return delete n.channel,n}),e}).catch(function(){return Promise.reject(new Error("Could not export your radio, sorry."))})},Object.defineProperty(n,"__esModule",{value:!0})});
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("isomorphic-unfetch")):"function"==typeof define&&define.amd?define(["exports","isomorphic-unfetch"],e):e(n.radio4000Sdk={},n.fetch)}(this,function(n,e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t=function(n,t){return void 0===t&&(t="https://radio4000.firebaseio.com"),e(t+"/"+n).then(function(n){return n.json()}).then(function(n){if(0===Object.keys(n).length)throw new Error("Not found");return n})},r=function(n,e){return Object.assign(n,{id:e})},o=function(n){return Object.keys(n).map(function(e){return r(n[e],e)})};var i=function(n){return t('channels.json?orderBy="slug"&startAt="'+n+'"&endAt="'+n+'"').then(o).then(function(n){return n[0]})},u=function(n){if("string"!=typeof n)throw new TypeError("Pass a string with a valid channel id");return t('tracks.json?orderBy="channel"&startAt="'+n+'"&endAt="'+n+'"').then(o).then(function(n){return n.sort(function(n,e){return n.created-e.created})})};n.findChannel=function(n){return t("channels/"+n+".json").then(function(e){return r(e,n)})},n.findChannels=function(n){var e="channels.json";return n&&(e+='?orderBy="created"&limitToFirst='+n),t(e).then(o)},n.findChannelBySlug=i,n.findTrack=function(n){return t("tracks/"+n+".json").then(function(e){return r(e,n)})},n.findTracksByChannel=u,n.createBackup=function(n){if(!n)throw new Error("Can not export channel without a `slug`");var e;return i(n).then(function(n){return delete n.images,delete n.channelPublic,delete n.favoriteChannels,delete n.isFeatured,delete n.isPremium,n.image&&(n.imageUrl="https://res.cloudinary.com/radio4000/image/upload/"+n.image),e=n,n}).then(function(n){return n.tracks?u(n.id).then(function(n){return e.tracks=n.map(function(n){return delete n.channel,n}),e}):n}).catch(function(){return Promise.reject(new Error("Could not backup your radio"))})},Object.defineProperty(n,"__esModule",{value:!0})});
//# sourceMappingURL=radio4000-sdk.min.js.map
{
"name": "radio4000-sdk",
"version": "0.1.0",
"version": "0.1.1",
"license": "MIT",

@@ -5,0 +5,0 @@ "main": "dist/radio4000-sdk.cjs.js",

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