Files: 6cc3ba8e958c74086d517dc9dfe1236bdde29e2d / blog / sync / isBlog.js
483 bytesRaw
1 | const nest = require('depnest') |
2 | const get = require('lodash/get') |
3 | |
4 | exports.gives = nest({ |
5 | 'blog.sync.isBlog': true, |
6 | }) |
7 | |
8 | const MIN_LENGTH_FOR_BLOG_POST = 800 |
9 | |
10 | exports.create = function (api) { |
11 | return nest({ |
12 | 'blog.sync.isBlog': isBlog |
13 | }) |
14 | |
15 | function isBlog (msg) { |
16 | const type = msg.value.content.type |
17 | if (type === 'blog') return true |
18 | if (type === 'post' && get(msg, 'value.content.text', '').length > MIN_LENGTH_FOR_BLOG_POST) return true |
19 | return false |
20 | } |
21 | } |
22 | |
23 |
Built with git-ssb-web