git ssb

0+

Piet / ssb-loomio



Tree: 9db352a29a6d5bac4344c081e9228bd03aaeb97c

Files: 9db352a29a6d5bac4344c081e9228bd03aaeb97c / 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