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.

39 lines
1.1 KiB

4 years ago
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. var _isCustomProp = require('./isCustomProp');
  6. var _isCustomProp2 = _interopRequireDefault(_isCustomProp);
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. const important = node => node.important;
  9. const unimportant = node => !node.important;
  10. const hasInherit = node => node.value.toLowerCase() === 'inherit';
  11. const hasInitial = node => node.value.toLowerCase() === 'initial';
  12. const hasUnset = node => node.value.toLowerCase() === 'unset';
  13. exports.default = (props, includeCustomProps = true) => {
  14. if (props.some(hasInherit) && !props.every(hasInherit)) {
  15. return false;
  16. }
  17. if (props.some(hasInitial) && !props.every(hasInitial)) {
  18. return false;
  19. }
  20. if (props.some(hasUnset) && !props.every(hasUnset)) {
  21. return false;
  22. }
  23. if (includeCustomProps && props.some(_isCustomProp2.default) && !props.every(_isCustomProp2.default)) {
  24. return false;
  25. }
  26. return props.every(unimportant) || props.every(important);
  27. };
  28. module.exports = exports['default'];