const sendSubscriptions = () => { const state = store.getState() const expanded = R.pipe( R.filter(RS.endsWith('.*')), R.map((key) => { const keyMinusWildcard = R.slice(0, -2, key) const value = RS.dotPath(keyMinusWildcard, state) if (R.is(Object, value) && !RS.isNilOrEmpty(value)) { return R.pipe( R.keys, R.map((key) => `${keyMinusWildcard}.${key}`) )(value) } return null }), R.concat(subscriptions), R.flatten, R.reject(RS.endsWith('.*')), R.uniq, R.sortBy(R.identity) )(subscriptions) const values = R.map((key) => [key, RS.dotPath(key, state)], expanded) client.sendCommand('redux.subscribe.values', {values}) }
// fishes out the values for the subscriptions in state and returns them export default (subscriptions, state) => { const cleanedState = getCleanedState(state) return R.pipe( R.map(R.when(R.isNil, R.always(''))), R.filter(RS.endsWith('.*')), R.map(key => { const keyMinusWildcard = R.slice(0, -2, key) const value = RS.dotPath(keyMinusWildcard, cleanedState) if (R.is(Object, value) && !RS.isNilOrEmpty(value)) { return R.pipe(R.keys, R.map(key => `${keyMinusWildcard}.${key}`))(value) } return [] }), R.concat(R.map(R.when(R.isNil, R.always('')), subscriptions)), R.flatten, R.reject(RS.endsWith('.*')), R.uniq, R.sortBy(R.identity), R.map(key => ({ path: key, value: RS.isNilOrEmpty(key) ? cleanedState : RS.dotPath(key, cleanedState) })) )(subscriptions) }
var sendSubscriptions = function sendSubscriptions() { var state = store.getState(); var expanded = R.pipe(R.filter(RS.endsWith('.*')), R.map(function (key) { var keyMinusWildcard = R.slice(0, -2, key); var value = RS.dotPath(keyMinusWildcard, state); if (R.is(Object, value) && !RS.isNilOrEmpty(value)) { return R.pipe(R.keys, R.map(function (key) { return keyMinusWildcard + '.' + key; }))(value); } return null; }), R.concat(subscriptions), R.flatten, R.reject(RS.endsWith('.*')), R.uniq, R.sortBy(R.identity))(subscriptions); var values = R.map(function (key) { return [key, RS.dotPath(key, state)]; }, expanded); client.sendCommand('redux.subscribe.values', { values: values }); };