Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
};
const songs = [
{
id: "ONE"
},
{
id: "TWO"
},
{
id: "THREE"
}
];
Bacon.zipAsArray(songs.map(_.partial(searchOnSpotify, Spotify))).subscribe(
function(ev) {
expect(ev.hasValue()).toBeTruthy();
expect(ev.value()).toStrictEqual([
{
id: "ONE",
spotify: null,
spotifyId: null
},
{
id: "TWO",
spotify: "https://open.spotify.com/2",
spotifyId: "2"
},
{
id: "THREE",
token_type: "type"
});
const data = getFipSongLists(
Fip,
Spotify,
wsPath,
["radio1", "radio2"],
p_token
);
const p_radio1 = data.radio1.fold([], (items, item) => items.concat([item]));
const p_radio2 = data.radio2.fold([], (items, item) => items.concat([item]));
Bacon.zipAsArray([p_radio1, p_radio2]).subscribe(function(ev) {
expect(ev.hasValue()).toBeTruthy();
const [radio1, radio2] = ev.value();
expect(radio1).toStrictEqual([
[],
[
{
type: "song",
song: {
id: "ONE",
spotify: null,
spotifyId: null
}
}
],
export function setFavoriteSongs(syncs, songs) {
if (typeof ga === "function") {
ga(
"send",
"event",
"favorites",
"syncs",
syncs.length > 1 ? "With Spotify" : "Without Spotify",
songs.length
);
}
return Bacon.zipAsArray(_.map(syncs, sync => sync.set(songs)));
}
export function getFavoriteSongs(syncs) {
const p_songLists = Bacon.zipAsArray(
_.map(syncs, sync => sync.get())
).toProperty();
return p_songLists
.map(function(songLists) {
const songs = _.flatten(songLists);
return _.uniqBy(songs, song => song.spotifyId);
})
.toProperty();
}
Store.prototype.combineOnce = function(streams, callback) {
return Bacon.zipAsArray(streams).onValue(function(combo) {
callback(combo);
return Bacon.noMore;
});
}
componentDidMount: function() {
this.unsubscribe =
Bacon.zipAsArray(StationDataStore.stationArrivalView, StationMetadataStore.stationsByCode)
.onValues((stationView, stationCodes) => {
this.stationCodes = stationCodes
this.setState({
stationView: stationView
})
})
LiveDataActions.trainListDidMount.onValue(() => LiveDataActions.station.push('TPE'))
LiveDataActions.trainListDidMount.push(true)
},
componentDidMount: function() {
this.unsubscribe =
Bacon.zipAsArray(StationDataStore.stationArrivalView, StationMetadataStore.stationsByCode)
.onValues((stationView, stationCodes) => {
this.stationCodes = stationCodes
this.setState({
dataSource: this.state.dataSource.cloneWithRows(stationView),
})
})
LiveDataActions.trainListDidMount.push(true)
},
Store.prototype.combine = function(streams, callback) {
return Bacon.zipAsArray(streams).onValue(callback);
};
var stations = Bacon.fromPromise(fetch(METADATA_URL))
.flatMap(response => Bacon.fromPromise(response.json()))
.toProperty()
var stationsByCode = stations.map(stations =>
_(stations)
.map(station => {
station.stationName = station.stationName.replace(' asema', '')
return station
})
.indexBy('stationShortCode')
.value()
)
var metadataForStation =
Bacon.zipAsArray(stationsByCode, LiveDataActions.station)
.map(params => {
[stations, station] = params
})
module.exports = {
stations: stations,
stationsByCode: stationsByCode
}
expect: function (streams, ex, assert)Â {
var a = streams.ships
.fold(0, function (acc, v) { return acc + v; });
var b = streams.threat.changes()
.fold([], '.concat');
var c = streams.postArrivalShips
.fold(0, function (acc, v) { return acc + v; });
var all = Bacon.zipAsArray(a,b,c)
.onValues(function (ships, threat, postArrivalShips) {
return assert(ships === 3 && _.isEqual(threat, threats) && postArrivalShips == 2);
});
shipSensorR.push(zrrkShip);
destroyerDistanceStreamR.push(8);
destroyerDistanceStreamR.push(7);
destroyerDistanceStreamR.push(4);
destroyerDistanceStreamR.push(2);
destroyerDistanceStreamR.push(0.5);
destroyerDistanceStreamR.push(0);
shipSensorR.push(earthianShip);
shipSensorR.push(zrrkShip);
shipSensorR.push(zrrkShip);
destroyerDistanceStreamR.end();
shipSensorR.end();