mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-24 17:35:16 +00:00
34 lines
781 B
JavaScript
34 lines
781 B
JavaScript
|
'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'];
|