From d65ee2759282349d14f5b1591254a3da5d874a59 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 7 May 2014 03:10:39 -0400 Subject: [PATCH] Switch to array uniquing function that keeps the first instance The previous version would keep only the last instance. This version requires the array to contain only primitives of a single data type, but I think that's OK for all of our uses. (This version should also be faster.) --- chrome/content/zotero/xpcom/utilities.js | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js index 6e0b66bc7..d425665cc 100644 --- a/chrome/content/zotero/xpcom/utilities.js +++ b/chrome/content/zotero/xpcom/utilities.js @@ -604,23 +604,19 @@ Zotero.Utilities = { /** * Return new array with duplicate values removed * - * From the JSLab Standard Library (JSL) - * Copyright 2007 - 2009 Tavs Dokkedahl - * Contact: http://www.jslab.dk/contact.php + * From http://stackoverflow.com/a/1961068 * * @param {Array} array * @return {Array} */ "arrayUnique":function(arr) { - var a = []; - var l = arr.length; - for(var i=0; i