@contrail/types
Advanced tools
Comparing version 3.0.91 to 3.0.92
@@ -5,16 +5,10 @@ "use strict"; | ||
function filterPropertiesByLevel(entity, properties) { | ||
const isItemOrProjectItem = entity?.typePath?.startsWith('item') || entity?.typePath?.startsWith('project-item'); | ||
if (!isItemOrProjectItem) { | ||
const isItemType = Boolean(entity?.typePath === 'item' || entity?.typePath?.startsWith('item:')); | ||
const isProjectItemType = entity?.typePath === 'project-item' || entity?.typePath?.startsWith('project-item:'); | ||
if (!isItemType && !isProjectItemType) { | ||
return properties; | ||
} | ||
const isOption = entity?.roles?.includes('option'); | ||
const filteredProperties = []; | ||
for (const property of properties) { | ||
if (property?.propertyLevel === 'family' && isOption) { | ||
continue; | ||
} | ||
filteredProperties.push(property); | ||
} | ||
return filteredProperties; | ||
return isOption ? properties.filter((p) => p.propertyLevel !== 'family') : properties; | ||
} | ||
exports.filterPropertiesByLevel = filterPropertiesByLevel; |
{ | ||
"name": "@contrail/types", | ||
"version": "3.0.91", | ||
"version": "3.0.92", | ||
"description": "Types Utility module", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
279976
7602