From 14a038c1d005290375231f81574c1c72befaeb2f Mon Sep 17 00:00:00 2001 From: Elmer de Looff Date: Wed, 30 Oct 2013 23:12:23 +0100 Subject: [PATCH] Test boolean truthness of string directly, use 'map' not 'each'. Since only the empty string returns false, the test for nonzero length can be expressed as a direct boolean check. Also replaced 'each' call with 'map', which removes an unused variable in the processing function. --- jquery.parsequery.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/jquery.parsequery.js b/jquery.parsequery.js index b0161d6..665f4ec 100644 --- a/jquery.parsequery.js +++ b/jquery.parsequery.js @@ -18,8 +18,8 @@ $.extend(config, $.parseQuery, options); config.query = config.query.replace(/^\?/, ''); - if (config.query.length > 0) { - $.each(config.query.split(config.separator), function (i, param) { + if (config.query) { + $.map(config.query.split(config.separator), function (param) { var pair = param.split('='), key = config.decode(pair.shift(), null).toString(), value = config.decode(pair.length ? pair.join('=') : null, key);