|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 13 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
691 bytes
|
| Line | |
|---|
| 1 | var configuration = require('../../configuration');
|
|---|
| 2 |
|
|---|
| 3 | function isComponentOf(property1, property2, shallow) {
|
|---|
| 4 | return isDirectComponentOf(property1, property2)
|
|---|
| 5 | || !shallow && !!configuration[property1.name].shorthandComponents && isSubComponentOf(property1, property2);
|
|---|
| 6 | }
|
|---|
| 7 |
|
|---|
| 8 | function isDirectComponentOf(property1, property2) {
|
|---|
| 9 | var descriptor = configuration[property1.name];
|
|---|
| 10 |
|
|---|
| 11 | return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1;
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | function isSubComponentOf(property1, property2) {
|
|---|
| 15 | return property1
|
|---|
| 16 | .components
|
|---|
| 17 | .some(function(component) {
|
|---|
| 18 | return isDirectComponentOf(component, property2);
|
|---|
| 19 | });
|
|---|
| 20 | }
|
|---|
| 21 |
|
|---|
| 22 | module.exports = isComponentOf;
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.