preview rendered

This commit is contained in:
Klemek
2019-07-15 15:52:36 +02:00
parent b61ddf744a
commit 07a45e9888
6 changed files with 117 additions and 75 deletions
+1
View File
@@ -24,6 +24,7 @@ try {
*/
const SUB_DEF = {
'_': 'string',
'text': 'string',
'icon': 'string',
'color': 'string',
+2 -2
View File
@@ -28,7 +28,7 @@ const self = {
* @returns {null|string}
*/
isValid: (obj, def) => {
const keys = Object.keys(def);
const keys = Object.keys(def).filter(k => k !== '_');
let key;
let type;
for (let i = 0; i < keys.length; i++) {
@@ -37,7 +37,7 @@ const self = {
if (type === 'object' && obj[key].length > 0)
type = 'array';
if (typeof def[key] === 'object') {
if (type && type !== 'object')
if (type && type !== 'object' && type !== def[key]['_'])
return key;
const res = self.isValid(type ? obj[key] : undefined, def[key]);
if (res)