How to use the most.combineArray function in most

To help you get started, we’ve selected a few most examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DerekCuevas / friend-list / motorcyclejs-solution / src / components / FriendList.js View on Github external
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$])
}
github aronallen / cycle-sandbox / sample / widget.ts View on Github external
.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)
                }
              }
github staltz / xstream / perf / combine.js View on Github external
.add('most', function(deferred) {
    runners.runMost(deferred,
      most.combineArray(add3, [m1, m2, m3]).filter(even).drain());
  }, options)
  .add('rx 5', function(deferred) {
github beyond-labs / react-mirror / src / utils / streams / combineValuesIntoEnum.js View on Github external
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)
    })
  )
}
github motorcyclejs / motorcyclejs / examples / todo-app / src / ui / helpers / switchCombine.ts View on Github external
(streams) => streams.length === 0 ?
        just([]) :
        combineArray(Array, streams as Array>),
      streams$,
github beyond-labs / react-mirror / src / utils / streams / combineNested.js View on Github external
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)
}
github beyond-labs / react-mirror / src / utils / streams / combineSimple.js View on Github external
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)
}
github tsers-js / core / packages / core / src / obs.js View on Github external
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)
})
github DerekCuevas / friend-list / motorcyclejs-solution / src / main.js View on Github external
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),
  }
}
github beyond-labs / react-mirror / index.js View on Github external
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);
};