frontend/.pnpm-store/v3/files/94/4b969709323849e7a9d3907e2ca7541c2074243e87c5ea951cb13e8191b8fb79cfe80a354b6fc7e9272a3559549e85ec24af891ca82e9fbceb9f30fb556efe

23 lines
681 B
Plaintext

var compactable = require('../compactable');
function isComponentOf(property1, property2, shallow) {
return isDirectComponentOf(property1, property2) ||
!shallow && !!compactable[property1.name].shorthandComponents && isSubComponentOf(property1, property2);
}
function isDirectComponentOf(property1, property2) {
var descriptor = compactable[property1.name];
return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1;
}
function isSubComponentOf(property1, property2) {
return property1
.components
.some(function (component) {
return isDirectComponentOf(component, property2);
});
}
module.exports = isComponentOf;