Files: b6089670d854fcefa6bc5ca05636a801707deb30 / modules / people-names.js
529 bytesRaw
1 | var Value = require('@mmckegg/mutant/value') |
2 | var plugs = require('patchbay/plugs') |
3 | var signifier = plugs.first(exports.signifier = []) |
4 | var computed = require('@mmckegg/mutant/computed') |
5 | |
6 | exports.people_names = function (ids) { |
7 | return computed(Array.from(ids).map(ObservName), join) || '' |
8 | } |
9 | |
10 | function join (...args) { |
11 | return args.join('\n') |
12 | } |
13 | |
14 | function ObservName (id) { |
15 | var obs = Value(id.slice(0, 10)) |
16 | signifier(id, (_, value) => { |
17 | if (value && value.length) { |
18 | obs.set(value[0].name) |
19 | } |
20 | }) |
21 | return obs |
22 | } |
23 |
Built with git-ssb-web