UNPKG

447 BJavaScriptView Raw
1'use strict';
2
3var utils = require('../utils');
4
5module.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};