mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-11 00:08:30 +01:00
35262e404b
* refactor: fix splash page button background color * refactor: regenerate OpenAPI client * refactor: clean up strategy parameter types * refactor: remove index signature from IConstraint * refactor: fix never-seen status in features list
17 lines
478 B
TypeScript
17 lines
478 B
TypeScript
import { singleValueOperators } from 'constants/operators';
|
|
import { IConstraint } from 'interfaces/strategy';
|
|
import { oneOf } from 'utils/oneOf';
|
|
import produce from 'immer';
|
|
|
|
export const cleanConstraint = (
|
|
constraint: Readonly<IConstraint>
|
|
): IConstraint => {
|
|
return produce(constraint, draft => {
|
|
if (oneOf(singleValueOperators, constraint.operator)) {
|
|
delete draft.values;
|
|
} else {
|
|
delete draft.value;
|
|
}
|
|
});
|
|
};
|