Commit 3c9734dbc87863e2373fcdfa511441b061e7a813
Makes types a bit more specific
Piet Geursen committed on 3/5/2018, 12:46:46 AMParent: 18f9223076dfa1bbba1b0c3dcc24fa951ea62e93
Files changed
poll/schema/details/chooseOne.js | changed |
position/schema/details/chooseOne.js | changed |
types.js | changed |
poll/schema/details/chooseOne.js | ||
---|---|---|
@@ -1,6 +1,6 @@ | ||
1 | -const { chooseOneType } = require('../../../types') | |
2 | -const typeStringPattern = `^${chooseOneType}$` | |
1 | +const { chooseOnePollType } = require('../../../types') | |
2 | +const typeStringPattern = `^${chooseOnePollType}$` | |
3 | 3 | |
4 | 4 | var schema = { |
5 | 5 | type: 'object', |
6 | 6 | required: ['type', 'choices'], |
position/schema/details/chooseOne.js | ||
---|---|---|
@@ -1,8 +1,8 @@ | ||
1 | 1 | const Validate = require('is-my-json-valid') |
2 | 2 | |
3 | -const typeString = 'chooseOne' | |
4 | -const typeStringPattern = `^${typeString}$` | |
3 | +const { chooseOnePositionType } = require('../../../types') | |
4 | +const typeStringPattern = `^${chooseOnePositionType}$` | |
5 | 5 | const typeStringRegex = new RegExp(typeStringPattern) |
6 | 6 | |
7 | 7 | function isValidTypeString (string) { |
8 | 8 | return typeStringRegex.test(string) |
@@ -10,9 +10,9 @@ | ||
10 | 10 | |
11 | 11 | function create ({choice, reason}) { |
12 | 12 | return { |
13 | 13 | choice, |
14 | - type: typeString, | |
14 | + type: chooseOnePositionType, | |
15 | 15 | reason |
16 | 16 | } |
17 | 17 | } |
18 | 18 |
Built with git-ssb-web