commit 397ea5875abd44894ef33abc24b5320f83a98a58 parent 2eef1702e0b0c959fb897ada874a300494ea214f Author: Dan Stillman <dstillman@zotero.org> Date: Fri, 5 May 2017 00:18:35 -0400 Use Set for arrayUnique Diffstat:
| M | chrome/content/zotero/xpcom/utilities.js | | | 14 | ++------------ |
1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -740,21 +740,11 @@ Zotero.Utilities = { /** * Return new array with duplicate values removed * - * From http://stackoverflow.com/a/1961068 - * * @param {Array} array * @return {Array} */ - "arrayUnique":function(arr) { - var u = {}, a = []; - for (var i=0, l=arr.length; i<l; ++i){ - if (u.hasOwnProperty(arr[i])) { - continue; - } - a.push(arr[i]); - u[arr[i]] = 1; - } - return a; + arrayUnique: function (arr) { + return [...new Set(arr)]; }, /**