{"ScriptPreparationCode":"//\r\nfilterFoo = (x) =\u003E\r\n x.action === \u0022BID\u0022 \u0026\u0026\r\n x.symbol.toLocaleLowerCase().includes(\u0027btc\u0027)\r\nsortFoo = (a, b) =\u003E {\r\n return a.price - b.price\r\n}\r\nreduceFoo = (value, item) =\u003E {\r\n if (\r\n !(\r\n item.action === \u0022BID\u0022 \u0026\u0026\r\n item.symbol.toLocaleLowerCase().includes(\u0027btc\u0027)\r\n )\r\n )\r\n return value;\r\n return value \u003E= item?.price ? value : item?.price;\r\n}\r\n//\r\narr = [{\r\n price: 1000000000,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 1000000,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 111111,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 100000,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 11111,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 10000,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 1111,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 1000,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 100,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 1,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022BTC_IRT\u0022\r\n}, {\r\n price: 11111,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022BTC_USDT\u0022\r\n}, {\r\n price: 25000,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022USDT_IRT\u0022\r\n}, {\r\n price: 11111,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022USDT_IRT\u0022\r\n}, {\r\n price: 10000,\r\n action: \u0022ASK\u0022,\r\n symbol: \u0022USDT_IRT\u0022\r\n}, {\r\n price: 1111,\r\n action: \u0022BID\u0022,\r\n symbol: \u0022USDT_IRT\u0022\r\n}]","TestCases":[{"Name":"sort-filter","Code":"const sorted = arr.filter(filterFoo).sort(sortFoo)\r\nconst bigPrice = sorted[0].price","IsDeferred":false},{"Name":"reduce","Code":"const bigPrice = arr.reduce(reduceFoo, 0)","IsDeferred":false}]}