pack() emits with the latest value of all sources, packed together.
You can use pack() to collect values from multiple sources:
  /*!*/import { wrap, pack, group, map } from '@connectv/core';
import { fromEvent } from 'rxjs';

let s = document.getElementById('s') as HTMLInputElement;
let n = document.getElementById('n') as HTMLInputElement;
let p = document.getElementById('p');

  wrap(fromEvent(s, 'input')).to(map(() => s.value)),  //--> pick a salute
  wrap(fromEvent(n, 'input')).to(map(() => n.value))   //--> pick a name
.to(map(v => v.join(' ')))                             //--> pack returns an array, lets join it
.subscribe(v => p.innerHTML = v);                      //--> say hi

First emission

pack() waits for all connected sources to emit at least once before its first emission:
  /*!*/import { wrap, pack, filter, map, group } from '@connectv/core';
import { fromEvent, interval } from 'rxjs';

let a = document.getElementById('a') as HTMLInputElement;
let b = document.getElementById('b') as HTMLInputElement;
let p = document.getElementById('p');

  wrap(fromEvent(a, 'input')).to(map(() => a.checked)),
  wrap(fromEvent(b, 'input')).to(map(() => b.checked))
.to(filter(v => v[1] && v[2]))       //--> only let values through if both checkboxes are checked
.to(map(v => v[0]))                  //--> map to the interval's value
.subscribe(v => p.innerHTML = v);    //--> display the beautiful

Further reading

Copied to Clipboard!