mirror of
https://github.com/Unleash/unleash.git
synced 2024-12-22 19:07:54 +01:00
ec77cd05ec
- fill full screen - be more responsive (don't show hamburger on desktop)
36 lines
958 B
JavaScript
36 lines
958 B
JavaScript
'use strict';
|
|
|
|
function addOldFields (feature) {
|
|
const modifiedFeature = Object.assign({}, feature);
|
|
if (!feature.strategies) {
|
|
modifiedFeature.strategies = [];
|
|
return modifiedFeature;
|
|
}
|
|
modifiedFeature.strategy = feature.strategies[0].name;
|
|
modifiedFeature.parameters = Object.assign({}, feature.strategies[0].parameters);
|
|
return modifiedFeature;
|
|
}
|
|
|
|
function isOldFomrat (feature) {
|
|
return feature.strategy && !feature.strategies;
|
|
}
|
|
|
|
function toNewFormat (feature) {
|
|
if (isOldFomrat(feature)) {
|
|
return {
|
|
name: feature.name,
|
|
description: feature.description,
|
|
enabled: feature.enabled,
|
|
strategies: [
|
|
{
|
|
name: feature.strategy,
|
|
parameters: Object.assign({}, feature.parameters),
|
|
},
|
|
],
|
|
};
|
|
}
|
|
return feature;
|
|
}
|
|
|
|
module.exports = { addOldFields, toNewFormat };
|