git ssb

0+

Matt McKegg / ssb-about



Commit e7f9b0b243ec462fc2628c0eb7b9be29b06c10f1

use more compact index form

Matt McKegg committed on 6/12/2017, 1:12:50 PM
Parent: 25a70276fabd9332f9e03d154fd2fc70b553cc2d

Files changed

index.jschanged
package.jsonchanged
index.jsView
@@ -8,9 +8,9 @@
88 get: 'async'
99 }
1010
1111 exports.init = function (ssb, config) {
12- return ssb._flumeUse('about', FlumeReduce(0, reduce, map))
12 + return ssb._flumeUse('about', FlumeReduce(1, reduce, map))
1313 }
1414
1515 function reduce (result, item) {
1616 if (!result) result = {}
@@ -20,9 +20,9 @@
2020 for (var key in item[target]) {
2121 var valuesForKey = valuesForId[key] = valuesForId[key] || {}
2222 for (var author in item[target][key]) {
2323 var value = item[target][key][author]
24- if (!valuesForKey[author] || value.lastSeq > valuesForKey[author].lastSeq) {
24 + if (!valuesForKey[author] || value[1] > valuesForKey[author][1]) {
2525 valuesForKey[author] = value
2626 }
2727 }
2828 }
@@ -39,12 +39,9 @@
3939
4040 for (var key in msg.value.content) {
4141 if (key !== 'about' && key !== 'type') {
4242 values[key] = {
43- [author]: {
44- value: msg.value.content[key],
45- lastSeq: msg.value.sequence
46- }
43 + [author]: [msg.value.content[key], msg.value.timestamp]
4744 }
4845 }
4946 }
5047
package.jsonView
@@ -1,12 +1,12 @@
11 {
22 "name": "ssb-about",
33 "description": "scuttlebot plugin for getting reduced 'about' state",
44 "version": "0.0.0",
5- "homepage": "https://github.com/ssbc/ssb-backlinks",
5 + "homepage": "https://github.com/ssbc/ssb-about",
66 "repository": {
77 "type": "git",
8- "url": "git://github.com/ssbc/ssb-backlinks.git"
8 + "url": "git://github.com/ssbc/ssb-about.git"
99 },
1010 "dependencies": {
1111 "flumeview-reduce": "^1.1.0",
1212 "ssb-ref": "^2.7.1"

Built with git-ssb-web