diff --git a/src/ArrayUtils.js b/src/ArrayUtils.js deleted file mode 100644 index ca1aea9b5b..0000000000 --- a/src/ArrayUtils.js +++ /dev/null @@ -1,30 +0,0 @@ -/* -Copyright 2018 New Vector - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -/** - * creates a new array with only the unique values of the given array - * @param {array} arr the array to deduplicate - * @return {array} the deduplicated array - */ -export function unique(arr) { - const cpy = []; - arr.forEach((el) => { - if (!cpy.includes(el)) { - cpy.push(el); - } - }); - return cpy; -} diff --git a/src/utils/DMRoomMap.js b/src/utils/DMRoomMap.js index 453d6c89b0..e0004ebc9d 100644 --- a/src/utils/DMRoomMap.js +++ b/src/utils/DMRoomMap.js @@ -15,7 +15,7 @@ limitations under the License. */ import MatrixClientPeg from '../MatrixClientPeg'; -import {unique} from '../ArrayUtils'; +import _uniq from 'lodash/uniq'; /** * Class that takes a Matrix Client and flips the m.direct map @@ -109,7 +109,7 @@ export default class DMRoomMap { userToRooms[userId] = [roomId]; } else { roomIds.push(roomId); - userToRooms[userId] = unique(roomIds); + userToRooms[userId] = _uniq(roomIds); } }); return true;