git ssb

0+

Piet / ssb-loomio



Commit b14ae17f8400040245944915070fb84b51d866d1

Adds note for use of function

Piet Geursen committed on 3/6/2018, 2:06:34 AM
Parent: 6cee7ba74d78d7a794627b917b1eef6f217416ff

Files changed

position/sync/chooseOneResults.jschanged
position/sync/chooseOneResults.jsView
@@ -1,11 +1,18 @@
11 var isArray = require('isarray')
2-var isPosition = require('../../isPosition')
32 var Position = require('../../position/sync/position')
43
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}) {
815 return positions.reduce(function (results, position) {
916 var { positionDetails: {choice} } = Position(position)
1017
1118 if (choice >= poll.pollDetails.choices.length || position.value.timestamp > poll.closesAt) {

Built with git-ssb-web