git ssb

0+

Piet / ssb-loomio



Commit 6cee7ba74d78d7a794627b917b1eef6f217416ff

Use destructuring

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

Files changed

position/sync/chooseOneResults.jschanged
position/sync/chooseOneResults.jsView
@@ -1,11 +1,13 @@
11 var isArray = require('isarray')
22 var isPosition = require('../../isPosition')
33 var Position = require('../../position/sync/position')
44
5+//Expects a po
6+
57 module.exports = function ({positions, poll}) { //postions must be of the correct type ie checked by the caller.
68 return positions.reduce(function (results, position) {
7- var { choice } = Position(position).positionDetails
9+ var { positionDetails: {choice} } = Position(position)
810
911 if (choice >= poll.pollDetails.choices.length || position.value.timestamp > poll.closesAt) {
1012 results.errors.invalidPositions.push(position)
1113 return results

Built with git-ssb-web