Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default friend$ => {
const friendList$ = friend$.filter(Array.isArray).multicast()
const isLoading$ = friend$.filter(friends => friends === 'loading')
.map(() => true)
.merge(friendList$.map(() => false))
.startWith(false)
return combineArray(view, [friendList$, isLoading$])
}
.select('svg')
.events('mousedown')
.map(() => 0).scan((acc, n) => acc * 1.1, 1)
const title$ = sources
.HTTP
.select()
.switch()
.map(e => e.body.message) as Stream;
const tick$ = periodic(1000 / 60, 0)
.scan((acc, n) => acc + 1, 0);
return {
HTTP: just(`./data.json?${Math.random()}`),
DOM:
combineArray(Array, [tick$, multiply$, title$])
.map(([n, freq, title]) => (
h('svg', {
attrs: {
title: title,
width: SIZE,
height: SIZE
}
},
[
h('polyline',
{
attrs: {
points: line(n, freq)
}
}
.add('most', function(deferred) {
runners.runMost(deferred,
most.combineArray(add3, [m1, m2, m3]).filter(even).drain());
}, options)
.add('rx 5', function(deferred) {
const combineValuesIntoEnum = (streams, ids) => {
if (!streams.length) return most.of(new Enum())
return most.combineArray(
(...values) => {
const result = {}
values.forEach((value, i) => {
if (value !== SKIP_TOKEN) result[ids[i]] = value
})
return new Enum(result)
},
streams.map($stream => {
const $start = most.of(SKIP_TOKEN).until($stream)
return $start.concat($stream)
})
)
}
(streams) => streams.length === 0 ?
just([]) :
combineArray(Array, streams as Array>),
streams$,
const combineNested = streamMap => {
const keys = Object.keys(streamMap)
const streams = keys.map(key => streamMap[key])
invariant(
streams.every($stream => $stream && $stream.subscribe),
'`combineNested` only accepts streams'
)
return most.combineArray((...enumCollection) => {
const result = {}
enumCollection.forEach(_enum_ => {
_enum_.forEach((value, i, key) => {
if (!result[key]) result[key] = {}
result[key][keys[i]] = value
})
})
return new Enum(result)
}, streams)
}
const combineSimple = (...streams) => {
if (streams[0] instanceof Array) streams = streams[0]
invariant(
streams.every($stream => $stream && $stream.subscribe),
'`combineSimple` only accepts streams'
)
return most.combineArray((...values) => [...values], streams)
}
export const combine = curry(function combine(streams) {
return !streams.length ? most.just([]) : most.combineArray(function () {
let a = arguments, i = a.length, comb = Array(i)
while (i--) comb[i] = a[i]
return comb
}, streams)
})
function main(sources) {
const searchInput = SearchInput(sources)
const view$ = combineArray(view, [
searchInput.DOM,
FriendList(sources.fetch)
])
return {
DOM: view$,
history: searchInput.searchValue$.map(q => q && {query: {q}} || '/' ),
fetch: sources.history.map(({query}) => query.q),
}
}
var combine$1 = function combine$$1() {
for (var _len = arguments.length, streams = Array(_len), _key = 0; _key < _len; _key++) {
streams[_key] = arguments[_key];
}
if (streams[0] instanceof Array) streams = streams[0];
invariant(streams.every(function ($stream) {
return $stream && $stream.subscribe;
}), '`combine` only accepts streams');
return most.combineArray(function () {
for (var _len2 = arguments.length, values = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
values[_key2] = arguments[_key2];
}
return [].concat(values);
}, streams);
};