www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 759f846610122b2ee42cc62954c536beb22a69a0
parent 8da5e3bc099d0c7026187f8cb005a69a4d72d090
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 30 Mar 2011 00:39:08 +0000

Missed file from previous commit


Diffstat:
Mchrome/content/zotero/xpcom/utilities.js | 26+++++++++++++++++++++++++-
1 file changed, 25 insertions(+), 1 deletion(-)

diff --git a/chrome/content/zotero/xpcom/utilities.js b/chrome/content/zotero/xpcom/utilities.js @@ -361,7 +361,31 @@ Zotero.Utilities = { } return vals; }, - + + /** + * 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 + * + * @param {Array} array + * @return {Array} + */ + "arrayUnique":function(arr) { + var a = []; + var l = arr.length; + for(var i=0; i<l; i++) { + for(var j=i+1; j<l; j++) { + // If this[i] is found later in the array + if (arr[i] === arr[j]) + j = ++i; + } + a.push(arr[i]); + } + return a; + }, + /** * Generate a random integer between min and max inclusive *