Files: ab2a7ca4c54c5bcaaffdd55eaad2490350509757 / sync / isBlog.js
546 bytesRaw
1 | const validator = require('is-my-json-valid') |
2 | const schema = require('../schema/blog') |
3 | const getMsgContent = require('../lib/getMsgContent') |
4 | |
5 | const isBlogContent = validator(schema, {verbose: true}) |
6 | |
7 | // server is not used here. Closure pattern is just for consistency of use with other functions. |
8 | module.exports = function (server) { |
9 | return function isBlog (obj) { |
10 | const result = isBlogContent(getMsgContent(obj)) |
11 | |
12 | // exposes error messages provided by is-my-json-valid |
13 | isBlog.errors = isBlogContent.errors |
14 | |
15 | return result |
16 | } |
17 | } |
18 |
Built with git-ssb-web