From 9e8559b4be4fdc9e1b407a4639356fe4fc5366a4 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 1 May 2013 18:23:09 -0400 Subject: [PATCH] Speed up flattenArguments() --- chrome/content/zotero/xpcom/zotero.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/xpcom/zotero.js b/chrome/content/zotero/xpcom/zotero.js index 017f43f4e..9684dcbaa 100644 --- a/chrome/content/zotero/xpcom/zotero.js +++ b/chrome/content/zotero/xpcom/zotero.js @@ -1435,28 +1435,26 @@ Components.utils.import("resource://gre/modules/Services.jsm"); * values and/or an arbitrary number of individual values */ function flattenArguments(args){ - var isArguments = args.callee && args.length; - // Put passed scalar values into an array - if (args === null || (args.constructor.name != 'Array' && !isArguments)) { + if (args === null || typeof args == 'string' || typeof args.length == 'undefined') { args = [args]; } var returns = []; for (var i=0; i