Commit 0f5ed1e921e14b6d02745c152fcdaeb2701aac89
oops, signifier, not signifiers
Dominic Tarr committed on 8/1/2016, 1:31:29 AMParent: 8418f87e82733cfd50038aed3b810e26957287fe
Files changed
modules/avatar-name.js | changed |
modules/names.js | changed |
modules/avatar-name.js | ||
---|---|---|
@@ -1,6 +1,7 @@ | ||
1 | 1 | |
2 | -var signifers = require('../plugs').first(exports.signifers = []) | |
2 | +var signifier = require('../plugs').first(exports.signifier = []) | |
3 | +var h = require('hyperscript') | |
3 | 4 | |
4 | 5 | exports.avatar_name = |
5 | 6 | function name (id) { |
6 | 7 | var n = h('span', id.substring(0, 10)) |
@@ -11,9 +12,9 @@ | ||
11 | 12 | //is pretty powerful! |
12 | 13 | //TODO: "most popular" name is easily gameable. |
13 | 14 | //must come up with something better than this. |
14 | 15 | |
15 | - exports.signifiers(id, function (_, names) { | |
16 | + signifier(id, function (_, names) { | |
16 | 17 | if(names.length) n.textContent = names[0].name |
17 | 18 | }) |
18 | 19 | |
19 | 20 | return n |
modules/names.js | ||
---|---|---|
@@ -1,15 +1,12 @@ | ||
1 | -var h = require('hyperscript') | |
2 | 1 | var pull = require('pull-stream') |
3 | 2 | |
4 | 3 | function all(stream, cb) { |
5 | 4 | pull(stream, pull.collect(cb)) |
6 | 5 | } |
7 | 6 | |
8 | 7 | var plugs = require('../plugs') |
9 | -var getAvatar = require('ssb-avatar') | |
10 | 8 | var sbot_links2 = plugs.first(exports.sbot_links2 = []) |
11 | -var sbot_links = plugs.first(exports.sbot_links = []) | |
12 | 9 | |
13 | 10 | /* |
14 | 11 | filter(rel: ['mentions', prefix('@')]) | reduce(name: rel[1], value: count()) |
15 | 12 | */ |
@@ -78,14 +75,13 @@ | ||
78 | 75 | function rank(ary) { |
79 | 76 | return ary.sort(function (a, b) { return b.rank - a.rank }) |
80 | 77 | } |
81 | 78 | |
82 | -exports.signifiers = async(function (id) { | |
79 | +exports.signifier = async(function (id) { | |
83 | 80 | return rank(names.filter(function (e) { return e.id == id})) |
84 | 81 | }) |
85 | 82 | |
86 | 83 | exports.signified = async(function (name) { |
87 | 84 | var rx = new RegExp('^'+name) |
88 | 85 | return rank(names.filter(function (e) { return rx.test(e.name) })) |
89 | 86 | }) |
90 | 87 | |
91 | - |
Built with git-ssb-web