Commit 09033d728a841a682c6a03b0e6f6b4c8f9a5f726
strange issue with Set, converted to arrays (hackish)
andre alves garzia committed on 2/2/2018, 4:21:11 AMParent: ed7ce18d13ca61dec8480839bd240b0f4d50ee43
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -1,16 +1,17 @@ | ||
1 | 1 … | const FlumeView = require('flumeview-reduce') |
2 | 2 … | const get = require('lodash/get') |
3 | 3 … | const set = require('lodash/set') |
4 | 4 … | |
5 | -const FLUME_VIEW_VERSION = 1.5 | |
5 … | +const FLUME_VIEW_VERSION = 1.10 | |
6 | 6 … | |
7 | 7 … | module.exports = { |
8 | 8 … | name: 'channel', |
9 | 9 … | version: require('./package.json').version, |
10 | 10 … | manifest: { |
11 | 11 … | get: 'async', |
12 | 12 … | stream: 'source', |
13 … | + subscription: 'async' | |
13 | 14 … | }, |
14 | 15 … | init: (server, config) => { |
15 | 16 … | console.log('///// CHANNELS plugin loaded /////') |
16 | 17 … | |
@@ -54,17 +55,19 @@ | ||
54 | 55 … | function reduce(soFar, newSub) { |
55 | 56 … | process.stdout.write('c') |
56 | 57 … | const { channel, author, subscribed } = newSub |
57 | 58 … | |
58 | - const channelSubs = get(soFar, [channel], new Set()) | |
59 … | + let channelSubs = get(soFar, [channel], []) | |
59 | 60 … | |
61 … | + channelSubs = new Set(channelSubs) | |
62 … | + | |
60 | 63 … | if (subscribed) { |
61 | 64 … | channelSubs.add(author) |
62 | 65 … | } else { |
63 | 66 … | channelSubs.delete(author) |
64 | 67 … | } |
65 | 68 … | |
66 | - soFar[channel] = channelSubs | |
69 … | + soFar[channel] = [...channelSubs] | |
67 | 70 … | |
68 | 71 … | return soFar |
69 | 72 … | } |
70 | 73 … |
Built with git-ssb-web