Added support for identity functions.

This commit is contained in:
orangemug
2020-04-12 16:25:32 +01:00
parent 8f722c59de
commit 7cfe0563bc
3 changed files with 176 additions and 106 deletions
+18
View File
@@ -0,0 +1,18 @@
/**
* If we don't have a default value just make one up
*/
export function findDefaultFromSpec (spec) {
if (spec.hasOwnProperty('default')) {
return spec.default;
}
const defaults = {
'color': '#000000',
'string': '',
'boolean': false,
'number': 0,
'array': [],
}
return defaults[spec.type] || '';
}