Files: af8e9b0bc28f9eb27558912de8569872ffa19022 / blog / sync / isBlog.js
690 bytesRaw
1 | const nest = require('depnest') |
2 | const get = require('lodash/get') |
3 | const isBlog = require('scuttle-blog/isBlog') |
4 | |
5 | exports.gives = nest({ |
6 | 'blog.sync.isBlog': true |
7 | }) |
8 | |
9 | const MIN_LENGTH_FOR_BLOG_POST = 800 |
10 | |
11 | exports.create = function (api) { |
12 | return nest({ |
13 | 'blog.sync.isBlog': isBloggy |
14 | }) |
15 | |
16 | function isBloggy (msg) { |
17 | // if (!isBlog(msg)) { |
18 | // console.log(isBlog.errors) |
19 | // console.log(JSON.stringify(msg.value.content, null, 2)) |
20 | // console.log('') |
21 | // } |
22 | if (isBlog(msg)) return true |
23 | |
24 | const type = msg.value.content.type |
25 | if (type === 'post' && get(msg, 'value.content.text', '').length > MIN_LENGTH_FOR_BLOG_POST) return true |
26 | return false |
27 | } |
28 | } |
29 |
Built with git-ssb-web