git ssb

0+

Josiah / ssb-tags



Commit 61c7de212f2f9e5ff13ceea09919dcb6d3774c27

Change decision functions to variables

Josiah Witt committed on 3/15/2018, 12:55:29 AM
Parent: 1f77997f086f31ce27aa9d3d2401244657e728f6

Files changed

index.jschanged
index.jsView
@@ -19,39 +19,32 @@
1919 if (!item) return result
2020
2121 var { root, tagKey, author, message, tagged, timestamp } = item
2222 var storedTimestamp = get(result, [author, tagKey, message])
23 + var shouldAddTag = tagged && (!storedTimestamp || timestamp > storedTimestamp)
24 + var shouldRemoveTag = storedTimestamp && tagged === false
2325
2426 if (root) {
2527 var rootTag = {
2628 [author]: {
2729 [tagKey]: {}
2830 }
2931 }
3032 result = merge(result, rootTag)
31- } else if (shouldAddTag()) {
33 + } else if (shouldAddTag) {
3234 var newTag = {
3335 [author]: {
3436 [tagKey]: {
3537 [message]: timestamp
3638 }
3739 }
3840 }
3941 result = merge(result, newTag)
40- } else if (shouldRemoveTag()) {
42 + } else if (shouldRemoveTag) {
4143 delete result[author][tagKey][message]
4244 }
4345
4446 return result
45-
46- function shouldAddTag() {
47- if (!tagged) return false
48- return !storedTimestamp || timestamp > storedTimestamp
49- }
50-
51- function shouldRemoveTag() {
52- return storedTimestamp && tagged === false
53- }
5447 }
5548
5649 function map(msg) {
5750 // only include your own tags (for now)

Built with git-ssb-web