UNPKG

552 BJavaScriptView Raw
1'use strict';
2
3var utils = require('../utils');
4
5module.exports = function(app) {
6 return {
7 type: ['object', 'string'],
8 normalize: function(val, key, config, schema) {
9 if (typeof val === 'undefined') {
10 return;
11 }
12 if (val === 'render') {
13 val = config[key] = true;
14 }
15 if (typeof val === 'boolean') {
16 return val;
17 }
18 if (utils.isObject(val) && val.hasOwnProperty('render')) {
19 val = config[key] = val.render;
20 return val;
21 }
22 delete config[key];
23 }
24 };
25};