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