web 3d图形渲染器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
681 B

  1. var compactable = require('../compactable');
  2. function isComponentOf(property1, property2, shallow) {
  3. return isDirectComponentOf(property1, property2) ||
  4. !shallow && !!compactable[property1.name].shorthandComponents && isSubComponentOf(property1, property2);
  5. }
  6. function isDirectComponentOf(property1, property2) {
  7. var descriptor = compactable[property1.name];
  8. return 'components' in descriptor && descriptor.components.indexOf(property2.name) > -1;
  9. }
  10. function isSubComponentOf(property1, property2) {
  11. return property1
  12. .components
  13. .some(function (component) {
  14. return isDirectComponentOf(component, property2);
  15. });
  16. }
  17. module.exports = isComponentOf;