[origin object array and expect object array ][1] origin object array: 0: amount: 100000000000000000000 feeTier: 0.3 price: 00000 priceDecimal: 0000 status: "unknown" tokenXAddr: "0x*********" tokenXSymbol: "USDC" tokenYAddr: "0x**********" tokenYSymbol: "aaa" 1: {orderId: '11', tokenXSymbol: 'USDC', tokenYSymbol: 'USDT', tokenXAddr: '0x**********', tokenYAddr: '0x**********', …} 2: {orderId: '4', tokenXSymbol: 'USDT', tokenYSymbol: 'USDC', tokenXAddr: '0x**********', tokenYAddr: '0x**********', …}
expect array: 0: {key: 'USDTUSDC0.3', data: Array(2), tokenXSymbol: 'USDT', tokenYSymbol: 'USDC', feeTier: 0.3} 1: {key: 'USDTUSDC0.05', data: Array(1), tokenXSymbol: 'USDT', tokenYSymbol: 'USDC', feeTier: 0.05}
I aim to rearrange an object array based on tokenxsymbol, tokenysymbol, and feetier within the object array. The approach is outlined below.