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.

33 lines
781 B

4 years ago
  1. 'use strict';
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = normalizeFlexFlow;
  6. // flex-flow: <flex-direction> || <flex-wrap>
  7. const flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];
  8. const flexWrap = ['nowrap', 'wrap', 'wrap-reverse'];
  9. function normalizeFlexFlow(flexFlow) {
  10. let order = {
  11. direction: '',
  12. wrap: ''
  13. };
  14. flexFlow.walk(({ value }) => {
  15. if (~flexDirection.indexOf(value.toLowerCase())) {
  16. order.direction = value;
  17. return;
  18. }
  19. if (~flexWrap.indexOf(value.toLowerCase())) {
  20. order.wrap = value;
  21. return;
  22. }
  23. });
  24. return `${order.direction} ${order.wrap}`.trim();
  25. };
  26. module.exports = exports['default'];