'never' 判定や flag 集計などは省略 ... const index = binarySearch(typeSet, type, getTypeId, compareValues); if (index < 0) { typeSet.splice(~index, 0, type); } return includes; } addTypeToUnion : Union に要素を追加する binarySearch = 二分探索 (O(log n) で挿入位置を発見) 比較キー: getTypeId / 比較関数: compareValues つまり「type ID を取り出して、数値として比較」 Copyright dip.inc All Rights Reserved. 12 / 33