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.
34 lines
781 B
34 lines
781 B
4 years ago
|
'use strict';
|
||
|
|
||
|
Object.defineProperty(exports, "__esModule", {
|
||
|
value: true
|
||
|
});
|
||
|
exports.default = normalizeFlexFlow;
|
||
|
// flex-flow: <flex-direction> || <flex-wrap>
|
||
|
|
||
|
const flexDirection = ['row', 'row-reverse', 'column', 'column-reverse'];
|
||
|
|
||
|
const flexWrap = ['nowrap', 'wrap', 'wrap-reverse'];
|
||
|
|
||
|
function normalizeFlexFlow(flexFlow) {
|
||
|
let order = {
|
||
|
direction: '',
|
||
|
wrap: ''
|
||
|
};
|
||
|
|
||
|
flexFlow.walk(({ value }) => {
|
||
|
if (~flexDirection.indexOf(value.toLowerCase())) {
|
||
|
order.direction = value;
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
if (~flexWrap.indexOf(value.toLowerCase())) {
|
||
|
order.wrap = value;
|
||
|
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
|
||
|
return `${order.direction} ${order.wrap}`.trim();
|
||
|
};
|
||
|
module.exports = exports['default'];
|