Commit b14ae17f8400040245944915070fb84b51d866d1
Adds note for use of function
Piet Geursen committed on 3/6/2018, 2:06:34 AMParent: 6cee7ba74d78d7a794627b917b1eef6f217416ff
Files changed
position/sync/chooseOneResults.js | changed |
position/sync/chooseOneResults.js | ||
---|---|---|
@@ -1,11 +1,18 @@ | ||
1 | 1 | var isArray = require('isarray') |
2 | -var isPosition = require('../../isPosition') | |
3 | 2 | var Position = require('../../position/sync/position') |
4 | 3 | |
5 | -//Expects a po | |
6 | - | |
7 | -module.exports = function ({positions, poll}) { //postions must be of the correct type ie checked by the caller. | |
4 | +//Expects `poll` and `position` objects passed in to be of shape: | |
5 | +//{ | |
6 | +// value: { | |
7 | +// content: {...}, | |
8 | +// timestamp: ... | |
9 | +// author: ... | |
10 | +// } | |
11 | +//} | |
12 | +// | |
13 | +//postions must be of the correct type ie: type checked by the caller. | |
14 | +module.exports = function ({positions, poll}) { | |
8 | 15 | return positions.reduce(function (results, position) { |
9 | 16 | var { positionDetails: {choice} } = Position(position) |
10 | 17 | |
11 | 18 | if (choice >= poll.pollDetails.choices.length || position.value.timestamp > poll.closesAt) { |
Built with git-ssb-web