From 3151bae751800cc7da1e208dad3983935d03b3da Mon Sep 17 00:00:00 2001 From: Philzen Date: Thu, 10 Apr 2014 08:00:31 +0200 Subject: [PATCH] Explicit comparison operator for length This yields more performance on some JavaScript engines as it saves one implicit type cast. --- sorting/natural.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sorting/natural.js b/sorting/natural.js index 5cc5e26..1a26f32 100644 --- a/sorting/natural.js +++ b/sorting/natural.js @@ -40,7 +40,7 @@ function naturalSort (a, b) { xN = x.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), yN = y.replace(re, '\0$1\0').replace(/\0$/,'').replace(/^\0/,'').split('\0'), // numeric, hex or date detection - xD = parseInt(x.match(hre), 10) || (xN.length != 1 && x.match(dre) && Date.parse(x)), + xD = parseInt(x.match(hre), 10) || (xN.length !== 1 && x.match(dre) && Date.parse(x)), yD = parseInt(y.match(hre), 10) || xD && y.match(dre) && Date.parse(y) || null; // first try and sort Hex codes or Dates