From b89651c6355a058f97b4719be336a31a3ef273b4 Mon Sep 17 00:00:00 2001 From: "Mark S. Miller" Date: Tue, 18 Aug 2020 14:55:44 -0700 Subject: [PATCH] fix: deduplicate redundant work (#1550) --- packages/zoe/src/contractSupport/zoeHelpers.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/zoe/src/contractSupport/zoeHelpers.js b/packages/zoe/src/contractSupport/zoeHelpers.js index 73f03577bc4..5b533c92ef5 100644 --- a/packages/zoe/src/contractSupport/zoeHelpers.js +++ b/packages/zoe/src/contractSupport/zoeHelpers.js @@ -16,7 +16,7 @@ const getKeysSorted = obj => /** * Given toGains (an AmountKeywordRecord), and allocations (a pair, - * 'to' and 'from', of AmountKeywordRecords), all the entries in + * 'to' and 'from', of Allocations), all the entries in * toGains will be added to 'to'. If fromLosses is defined, all the * entries in fromLosses are subtracted from 'from'. (If fromLosses * is not defined, toGains is subtracted from 'from'.) @@ -67,10 +67,7 @@ const calcNewAllocations = ( ], ); - const allToKeywords = [ - ...Object.keys(toGains), - ...Object.keys(allocations.to), - ]; + const allToKeywords = Object.keys({ ...allocations.to, ...toGains }); const newToAllocation = Object.fromEntries( allToKeywords.map(keyword => [