git ssb

0+

Piet / ssb-loomio



Tree: 028237b4b26db208a93b7399ed9575c6608b1999

Files: 028237b4b26db208a93b7399ed9575c6608b1999 / position / sync / isPosition.js

744 bytesRaw
1const validator = require('is-my-json-valid')
2const schema = require('../schema/position')
3const isPositionContent = validator(schema, {verbose: true})
4const getMsgContent = require('../../lib/getMsgContent')
5const { CHOOSE_ONE } = require('../../types')
6
7const isChooseOnePosition = require('./isChooseOnePosition')()
8
9// server is not used here. Closure pattern is just for consistency of use with other functions.
10module.exports = function (server) {
11 function isPosition (obj) {
12 const result = isPositionContent(getMsgContent(obj))
13
14 // exposes error messages provided by is-my-json-valid
15 isPosition.errors = isPositionContent.errors
16
17 return result
18 }
19
20 isPosition[CHOOSE_ONE] = isChooseOnePosition
21
22 return isPosition
23}
24

Built with git-ssb-web