{"ScriptPreparationCode":null,"TestCases":[{"Name":"With spread","Code":"const EXCLUDED_FILTERS_FOR_COUNT = [\r\n \u0027type\u0027,\r\n \u0027product\u0027,\r\n];\r\n\r\nconst getMandatoryAndOptionalFilters = (\r\n filters\r\n) =\u003E {\r\n if (!filters) return {};\r\n return Object.entries(filters).reduce(\r\n (acc, [currentFilterKey, currentFilterValue]) =\u003E {\r\n if (\r\n EXCLUDED_FILTERS_FOR_COUNT.includes(currentFilterKey)\r\n ) {\r\n return {\r\n ...acc,\r\n mandatory: {\r\n ...(acc.mandatory ?? {}),\r\n [currentFilterKey]: currentFilterValue,\r\n },\r\n };\r\n }\r\n return {\r\n ...acc,\r\n optional: {\r\n ...(acc.optional ?? {}),\r\n [currentFilterKey]: currentFilterValue,\r\n },\r\n };\r\n },\r\n {}\r\n );\r\n};\r\n\r\ngetMandatoryAndOptionalFilters({\r\n type: \u0022aa\u0022,\r\n category: \u0022cat1;cat2\u0022,\r\n paymentType: \u0022payment\u0022,\r\n otherFilter: \u0022otherFilter\u0022\r\n});","IsDeferred":false},{"Name":"Without spread","Code":"const EXCLUDED_FILTERS_FOR_COUNT = [\u0022type\u0022, \u0022product\u0022];\r\n\r\nconst getMandatoryAndOptionalFilters = (\r\n filters\r\n) =\u003E {\r\n if (!filters) return {};\r\n return Object.entries(filters).reduce(\r\n (acc, [currentFilterKey, currentFilterValue]) =\u003E {\r\n if (\r\n EXCLUDED_FILTERS_FOR_COUNT.includes(currentFilterKey)\r\n ) {\r\n acc.mandatory = {\r\n ...(acc.mandatory ?? {}),\r\n [currentFilterKey]: currentFilterValue,\r\n };\r\n }\r\n else {\r\n acc.optional = {\r\n ...(acc.optional ?? {}), [currentFilterKey]: currentFilterValue,\r\n };\r\n }\r\n \r\n return acc;\r\n },\r\n {}\r\n );\r\n};\r\n\r\ngetMandatoryAndOptionalFilters({\r\n type: \u0022aa\u0022,\r\n category: \u0022cat1;cat2\u0022,\r\n paymentType: \u0022payment\u0022,\r\n otherFilter: \u0022otherFilter\u0022,\r\n});","IsDeferred":false}]}