Last change
on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
719 bytes
|
Line | |
---|
1 | "use strict";
|
---|
2 |
|
---|
3 | Object.defineProperty(exports, "__esModule", {
|
---|
4 | value: true
|
---|
5 | });
|
---|
6 | exports.default = normalizeFlexFlow;
|
---|
7 | // flex-flow: <flex-direction> || <flex-wrap>
|
---|
8 | const flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];
|
---|
9 | const flexWrap = ['nowrap', 'wrap', 'wrap-reverse'];
|
---|
10 |
|
---|
11 | function normalizeFlexFlow(flexFlow) {
|
---|
12 | let order = {
|
---|
13 | direction: '',
|
---|
14 | wrap: ''
|
---|
15 | };
|
---|
16 | flexFlow.walk(({
|
---|
17 | value
|
---|
18 | }) => {
|
---|
19 | if (~flexDirection.indexOf(value.toLowerCase())) {
|
---|
20 | order.direction = value;
|
---|
21 | return;
|
---|
22 | }
|
---|
23 |
|
---|
24 | if (~flexWrap.indexOf(value.toLowerCase())) {
|
---|
25 | order.wrap = value;
|
---|
26 | return;
|
---|
27 | }
|
---|
28 | });
|
---|
29 | return `${order.direction} ${order.wrap}`.trim();
|
---|
30 | }
|
---|
31 |
|
---|
32 | module.exports = exports.default; |
---|
Note:
See
TracBrowser
for help on using the repository browser.