1 | ;
|
2 |
|
3 | var utils = require('../utils');
|
4 |
|
5 | module.exports = function(app, options) {
|
6 | return function(val, key, config, schema) {
|
7 | if (typeof val === 'undefined') {
|
8 | return;
|
9 | }
|
10 |
|
11 | if (val === true) {
|
12 | return { show: true };
|
13 | }
|
14 |
|
15 | if (typeof val === 'string') {
|
16 | val = val.split(',');
|
17 | }
|
18 |
|
19 | val = utils.unify(val);
|
20 | val = utils.unique(val);
|
21 | val.sort();
|
22 |
|
23 | config[key] = val;
|
24 | return val;
|
25 | };
|
26 | };
|