git ssb

0+

Piet / ssb-loomio



Tree: 4ae9c2d21f4b6d8fc91aeb1a890c40180b8a4c7f

Files: 4ae9c2d21f4b6d8fc91aeb1a890c40180b8a4c7f / poll / sync / isPoll.js

700 bytesRaw
1const Validator = require('is-my-json-valid')
2const schema = require('../schema/poll')
3const validator = Validator(schema, {verbose: true})
4const getMsgContent = require('../../lib/getMsgContent')
5
6const isChooseOnePoll = require('./isChooseOnePoll')()
7
8// server is not used here. Closure pattern is just for consistency of use with other functions.
9module.exports = function (server) {
10 function isPoll (obj) {
11 const result = validator(getMsgContent(obj))
12
13 // exposes error messages provided by is-my-json-valid
14 isPoll.errors = validator.errors
15
16 return result
17 }
18
19 isPoll.chooseOne = isChooseOnePoll
20 // isPoll.dot = isDotPoll
21 // isPoll.score = isScorePoll
22
23 return isPoll
24}
25

Built with git-ssb-web