From 3951345f69d110f6776fe8d00e4ebaf5f95d6d59 Mon Sep 17 00:00:00 2001 From: Rob Garrison Date: Thu, 12 Jul 2012 02:25:32 -0500 Subject: [PATCH] optimized ipAddress parser --- js/jquery.tablesorter.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/js/jquery.tablesorter.js b/js/jquery.tablesorter.js index f3aecd48..4d7f8e0c 100644 --- a/js/jquery.tablesorter.js +++ b/js/jquery.tablesorter.js @@ -1023,18 +1023,11 @@ return (/^\d{1,3}[\.]\d{1,3}[\.]\d{1,3}[\.]\d{1,3}$/).test(s); }, format: function(s, table) { - var i, item, a = s.split("."), + var i, a = s.split("."), r = "", l = a.length; for (i = 0; i < l; i++) { - item = a[i]; - if (item.length === 1) { - r += "00" + item; - } else if (item.length === 2) { - r += "0" + item; - } else { - r += item; - } + r += ("00" + a[i]).slice(-3); } return ts.formatFloat(r, table); },