Files: bd34a8d22b29ba32048c072fecfaaa2d0fb0af0f / 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