2019-10-24 14:07:41 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the attribute keys of the component related attributes
|
|
|
|
*/
|
2019-10-28 12:25:06 +01:00
|
|
|
function getComponentAttributes(definition) {
|
|
|
|
return Object.keys(definition.attributes).filter(key =>
|
|
|
|
['component', 'dynamiczone'].includes(definition.attributes[key].type)
|
2019-10-24 14:07:41 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2019-10-28 17:04:29 +01:00
|
|
|
const isComponent = (def, key) =>
|
|
|
|
['component', 'dynamiczone'].includes(def.attributes[key].type);
|
|
|
|
|
2019-10-24 14:07:41 +02:00
|
|
|
module.exports = {
|
|
|
|
getComponentAttributes,
|
2019-10-28 17:04:29 +01:00
|
|
|
isComponent,
|
2019-10-24 14:07:41 +02:00
|
|
|
};
|