diff --git a/sorting/alt-string.js b/sorting/alt-string.js
index 7478848..6d0faf1 100644
--- a/sorting/alt-string.js
+++ b/sorting/alt-string.js
@@ -7,17 +7,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
+ "alt-string-pre": function ( a ) {
+ return a.match(/alt="(.*?)"/)[1].toLowerCase();
+ },
+
"alt-string-asc": function( a, b ) {
- var x = a.match(/alt="(.*?)"/)[1].toLowerCase();
- var y = b.match(/alt="(.*?)"/)[1].toLowerCase();
-
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"alt-string-desc": function(a,b) {
- var x = a.match(/alt="(.*?)"/)[1].toLowerCase();
- var y = b.match(/alt="(.*?)"/)[1].toLowerCase();
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/anti-the.js b/sorting/anti-the.js
index b95059e..0602e31 100644
--- a/sorting/anti-the.js
+++ b/sorting/anti-the.js
@@ -8,17 +8,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "anti-the-asc": function ( a, b ) {
- var x = a.replace(/^the /i, "");
- var y = b.replace(/^the /i, "");
+ "anti-the-pre": function ( a ) {
+ return a.replace(/^the /i, "");
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "anti-the-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"anti-the-desc": function ( a, b ) {
- var x = a.replace(/^the /i, "");
- var y = b.replace(/^the /i, "");
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/currency.js b/sorting/currency.js
index 57c360d..0ee73e0 100644
--- a/sorting/currency.js
+++ b/sorting/currency.js
@@ -7,25 +7,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "currency-asc": function ( a, b ) {
- /* Remove any formatting */
- var x = a == "-" ? 0 : a.replace( /[^\d\-\.]/g, "" );
- var y = b == "-" ? 0 : b.replace( /[^\d\-\.]/g, "" );
-
- /* Parse and return */
- x = parseFloat( x );
- y = parseFloat( y );
+ "currency-pre": function ( a ) {
+ a = (a==="-") ? 0 : a.replace( /[^\d\-\.]/g, "" );
+ return parseFloat( a );
+ },
- return x - y;
+ "currency-asc": function ( a, b ) {
+ return a - b;
},
"currency-desc": function ( a, b ) {
- var x = a == "-" ? 0 : a.replace( /[^\d\-\.]/g, "" );
- var y = b == "-" ? 0 : b.replace( /[^\d\-\.]/g, "" );
-
- x = parseFloat( x );
- y = parseFloat( y );
-
- return y - x;
+ return b - a;
}
} );
diff --git a/sorting/date-eu.js b/sorting/date-eu.js
index acbb332..fbf1d48 100644
--- a/sorting/date-eu.js
+++ b/sorting/date-eu.js
@@ -6,55 +6,45 @@
* @author Robert Sedovšek
*/
- (function(){
-
-function calculate_date(date) {
- var date = date.replace(" ", "");
-
- if (date.indexOf('.') > 0) {
- /*date a, format dd.mn.(yyyy) ; (year is optional)*/
- var eu_date = date.split('.');
- } else {
- /*date a, format dd/mn/(yyyy) ; (year is optional)*/
- var eu_date = date.split('/');
- }
-
- /*year (optional)*/
- if (eu_date[2]) {
- var year = eu_date[2];
- } else {
- var year = 0;
- }
-
- /*month*/
- var month = eu_date[1];
- if (month.length == 1) {
- month = 0+month;
- }
-
- /*day*/
- var day = eu_date[0];
- if (day.length == 1) {
- day = 0+day;
- }
-
- return (year + month + day) * 1;
-}
-
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "date-eu-asc": function ( a, b ) {
- x = calculate_date(a);
- y = calculate_date(b);
-
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
- },
+ "date-eu-pre": function ( date ) {
+ var date = date.replace(" ", "");
+
+ if (date.indexOf('.') > 0) {
+ /*date a, format dd.mn.(yyyy) ; (year is optional)*/
+ var eu_date = date.split('.');
+ } else {
+ /*date a, format dd/mn/(yyyy) ; (year is optional)*/
+ var eu_date = date.split('/');
+ }
+
+ /*year (optional)*/
+ if (eu_date[2]) {
+ var year = eu_date[2];
+ } else {
+ var year = 0;
+ }
+
+ /*month*/
+ var month = eu_date[1];
+ if (month.length == 1) {
+ month = 0+month;
+ }
+
+ /*day*/
+ var day = eu_date[0];
+ if (day.length == 1) {
+ day = 0+day;
+ }
+
+ return (year + month + day) * 1;
+ },
- "date-eu-desc": function ( a, b ) {
- x = calculate_date(a);
- y = calculate_date(b);
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
- }
-} );
+ "date-eu-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
+ },
-}());
+ "date-eu-desc": function ( a, b ) {
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+ }
+} );
diff --git a/sorting/date-euro.js b/sorting/date-euro.js
index 2090ab6..d2fa06c 100644
--- a/sorting/date-euro.js
+++ b/sorting/date-euro.js
@@ -8,7 +8,7 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "date-euro-asc": function ( a, b ) {
+ "date-euro-pre": function ( a ) {
if ($.trim(a) != '') {
var frDatea = $.trim(a).split(' ');
var frTimea = frDatea[1].split(':');
@@ -17,38 +17,15 @@
} else {
var x = 10000000000000; // = l'an 1000 ...
}
-
- if ($.trim(b) != '') {
- var frDateb = $.trim(b).split(' ');
- var frTimeb = frDateb[1].split(':');
- frDateb = frDateb[0].split('/');
- var y = (frDateb[2] + frDateb[1] + frDateb[0] + frTimeb[0] + frTimeb[1] + frTimeb[2]) * 1;
- } else {
- var y = 10000000000000;
- }
- var z = ((x < y) ? -1 : ((x > y) ? 1 : 0));
- return z;
+
+ return x;
+ },
+
+ "date-euro-asc": function ( a, b ) {
+ return a - b;
},
"date-euro-desc": function ( a, b ) {
- if ($.trim(a) != '') {
- var frDatea = $.trim(a).split(' ');
- var frTimea = frDatea[1].split(':');
- var frDatea2 = frDatea[0].split('/');
- var x = (frDatea2[2] + frDatea2[1] + frDatea2[0] + frTimea[0] + frTimea[1] + frTimea[2]) * 1;
- } else {
- var x = 10000000000000;
- }
-
- if ($.trim(b) != '') {
- var frDateb = $.trim(b).split(' ');
- var frTimeb = frDateb[1].split(':');
- frDateb = frDateb[0].split('/');
- var y = (frDateb[2] + frDateb[1] + frDateb[0] + frTimeb[0] + frTimeb[1] + frTimeb[2]) * 1;
- } else {
- var y = 10000000000000;
- }
- var z = ((x < y) ? 1 : ((x > y) ? -1 : 0));
- return z;
+ return b - a;
}
} );
diff --git a/sorting/date-uk.js b/sorting/date-uk.js
index 26b3027..bf357af 100644
--- a/sorting/date-uk.js
+++ b/sorting/date-uk.js
@@ -10,23 +10,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "date-uk-asc": function ( a, b ) {
+ "date-uk-pre": function ( a ) {
var ukDatea = a.split('/');
- var ukDateb = b.split('/');
-
- var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
- var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
-
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ return (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
+ },
+
+ "date-uk-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"date-uk-desc": function ( a, b ) {
- var ukDatea = a.split('/');
- var ukDateb = b.split('/');
-
- var x = (ukDatea[2] + ukDatea[1] + ukDatea[0]) * 1;
- var y = (ukDateb[2] + ukDateb[1] + ukDateb[0]) * 1;
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/enum.js b/sorting/enum.js
index 06897ce..823d541 100644
--- a/sorting/enum.js
+++ b/sorting/enum.js
@@ -7,32 +7,22 @@
* @author Allan Jardine
*/
-(function() {
-
-function priority( a ) {
- // Add / alter the switch statement below to match your enum list
- switch( a ) {
- case "High": return 1;
- case "Medium": return 2;
- case "Low": return 3;
- default: return 4;
- }
-}
-
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "enum-asc": function ( a, b ) {
- var x = priority( a );
- var y = priority( b );
-
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
- },
+ "enum-pre": function ( a ) {
+ // Add / alter the switch statement below to match your enum list
+ switch( a ) {
+ case "High": return 1;
+ case "Medium": return 2;
+ case "Low": return 3;
+ default: return 4;
+ }
+ },
- "enum-desc": function ( a, b ) {
- var x = priority( a );
- var y = priority( b );
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
- }
-} );
+ "enum-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
+ },
-}());
\ No newline at end of file
+ "enum-desc": function ( a, b ) {
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+ }
+} );
diff --git a/sorting/file-size.js b/sorting/file-size.js
index c4b6d8d..75d31ef 100644
--- a/sorting/file-size.js
+++ b/sorting/file-size.js
@@ -9,33 +9,20 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "file-size-asc": function ( a, b ) {
+ "file-size-pre": function ( a ) {
var x = a.substring(0,a.length - 2);
- var y = b.substring(0,b.length - 2);
var x_unit = (a.substring(a.length - 2, a.length) == "MB" ?
1000 : (a.substring(a.length - 2, a.length) == "GB" ? 1000000 : 1));
- var y_unit = (b.substring(b.length - 2, b.length) == "MB" ?
- 1000 : (b.substring(b.length - 2, b.length) == "GB" ? 1000000 : 1));
-
- x = parseInt( x * x_unit );
- y = parseInt( y * y_unit );
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ return parseInt( x * x_unit, 10 );
+ },
+
+ "file-size-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"file-size-desc": function ( a, b ) {
- var x = a.substring(0,a.length - 2);
- var y = b.substring(0,b.length - 2);
-
- var x_unit = (a.substring(a.length - 2, a.length) == "MB" ?
- 1000 : (a.substring(a.length - 2, a.length) == "GB" ? 1000000 : 1));
- var y_unit = (b.substring(b.length - 2, b.length) == "MB" ?
- 1000 : (b.substring(b.length - 2, b.length) == "GB" ? 1000000 : 1));
-
- x = parseInt( x * x_unit);
- y = parseInt( y * y_unit);
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/ip-address.js b/sorting/ip-address.js
index 283068c..7e19d69 100644
--- a/sorting/ip-address.js
+++ b/sorting/ip-address.js
@@ -8,9 +8,9 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "ip-address-asc": function ( a, b ) {
+ "ip-address-pre": function ( a ) {
var m = a.split("."), x = "";
- var n = b.split("."), y = "";
+
for(var i = 0; i < m.length; i++) {
var item = m[i];
if(item.length == 1) {
@@ -21,42 +21,15 @@ jQuery.extend( jQuery.fn.dataTableExt.oSort, {
x += item;
}
}
- for(var i = 0; i < n.length; i++) {
- var item = n[i];
- if(item.length == 1) {
- y += "00" + item;
- } else if(item.length == 2) {
- y += "0" + item;
- } else {
- y += item;
- }
- }
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+
+ return x;
+ },
+
+ "ip-address-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"ip-address-desc": function ( a, b ) {
- var m = a.split("."), x = "";
- var n = b.split("."), y = "";
- for(var i = 0; i < m.length; i++) {
- var item = m[i];
- if(item.length == 1) {
- x += "00" + item;
- } else if (item.length == 2) {
- x += "0" + item;
- } else {
- x += item;
- }
- }
- for(var i = 0; i < n.length; i++) {
- var item = n[i];
- if(item.length == 1) {
- y += "00" + item;
- } else if (item.length == 2) {
- y += "0" + item;
- } else {
- y += item;
- }
- }
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/monthYear.js b/sorting/monthYear.js
index 3b41413..6a95113 100644
--- a/sorting/monthYear.js
+++ b/sorting/monthYear.js
@@ -8,15 +8,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
+ "monthYear-pre": function ( a ) {
+ return new Date('01 '+a);
+ },
+
"monthYear-asc": function ( a, b ) {
- a = new Date('01 '+a);
- b = new Date('01 '+b);
- return ((a < b) ? -1 : ((a > b) ? 1 : 0));
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"monthYear-desc": function ( a, b ) {
- a = new Date('01 '+a);
- b = new Date('01 '+b);
return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/num-html.js b/sorting/num-html.js
index b779c13..c0e7be6 100644
--- a/sorting/num-html.js
+++ b/sorting/num-html.js
@@ -9,21 +9,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "num-html-asc": function ( a, b ) {
- var x = a.replace( /<.*?>/g, "" );
- var y = b.replace( /<.*?>/g, "" );
- x = parseFloat( x );
- y = parseFloat( y );
+ "num-html-pre": function ( a ) {
+ var x = a.replace( /<.*?>/g, "" );
+ return parseFloat( x );
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
- },
+ "num-html-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
+ },
- "num-html-desc": function ( a, b ) {
- var x = a.replace( /<.*?>/g, "" );
- var y = b.replace( /<.*?>/g, "" );
- x = parseFloat( x );
- y = parseFloat( y );
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
- }
+ "num-html-desc": function ( a, b ) {
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
+ }
} );
diff --git a/sorting/numeric-comma.js b/sorting/numeric-comma.js
index aca68c0..87da421 100644
--- a/sorting/numeric-comma.js
+++ b/sorting/numeric-comma.js
@@ -8,21 +8,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "numeric-comma-asc": function ( a, b ) {
+ "numeric-comma-pre": function ( a ) {
var x = (a == "-") ? 0 : a.replace( /,/, "." );
- var y = (b == "-") ? 0 : b.replace( /,/, "." );
- x = parseFloat( x );
- y = parseFloat( y );
+ return parseFloat( x );
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "numeric-comma-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"numeric-comma-desc": function ( a, b ) {
- var x = (a == "-") ? 0 : a.replace( /,/, "." );
- var y = (b == "-") ? 0 : b.replace( /,/, "." );
- x = parseFloat( x );
- y = parseFloat( y );
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/percent.js b/sorting/percent.js
index 36afc35..b531c50 100644
--- a/sorting/percent.js
+++ b/sorting/percent.js
@@ -5,21 +5,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "percent-asc": function ( a, b ) {
+ "percent-pre": function ( a ) {
var x = (a == "-") ? 0 : a.replace( /%/, "" );
- var y = (b == "-") ? 0 : b.replace( /%/, "" );
- x = parseFloat( x );
- y = parseFloat( y );
+ return parseFloat( x );
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "percent-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"percent-desc": function ( a, b ) {
- var x = (a == "-") ? 0 : a.replace( /%/, "" );
- var y = (b == "-") ? 0 : b.replace( /%/, "" );
- x = parseFloat( x );
- y = parseFloat( y );
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/persian.js b/sorting/persian.js
index 18c65df..bf34368 100644
--- a/sorting/persian.js
+++ b/sorting/persian.js
@@ -32,18 +32,16 @@ function GetUniCode(source) {
};
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "pstring-asc": function ( a, b ) {
- var x = GetUniCode(a.toLowerCase());
- var y = GetUniCode(b.toLowerCase());
+ "pstring-pre": function ( a ) {
+ return GetUniCode(a.toLowerCase());
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "pstring-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"pstring-desc": function ( a, b ) {
- var x = GetUniCode(a.toLowerCase());
- var y = GetUniCode(b.toLowerCase());
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/scientific.js b/sorting/scientific.js
index bfa2130..efac96b 100644
--- a/sorting/scientific.js
+++ b/sorting/scientific.js
@@ -6,17 +6,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "scientific-asc": function ( a, b ) {
- var x = parseFloat(a);
- var y = parseFloat(b);
+ "scientific-pre": function ( a ) {
+ return parseFloat(a);
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "scientific-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"scientific-desc": function ( a, b ) {
- var x = parseFloat(a);
- var y = parseFloat(b);
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/signed-num.js b/sorting/signed-num.js
index d35ae82..654a82b 100644
--- a/sorting/signed-num.js
+++ b/sorting/signed-num.js
@@ -7,15 +7,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
+ "signed-num-pre": function ( a ) {
+ return (a=="-" || a==="") ? 0 : a.replace('+','')*1;
+ },
+
"signed-num-asc": function ( a, b ) {
- var x = (a=="-" || a==="") ? 0 : a.replace('+','')*1;
- var y = (b=="-" || b==="") ? 0 : b.replace('+','')*1;
- return x - y;
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"signed-num-desc": function ( a, b ) {
- var x = (a=="-" || a==="") ? 0 : a.replace('+','')*1;
- var y = (b=="-" || b==="") ? 0 : b.replace('+','')*1;
- return y - x;
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/title-numeric.js b/sorting/title-numeric.js
index 3f90838..e6f1196 100644
--- a/sorting/title-numeric.js
+++ b/sorting/title-numeric.js
@@ -11,21 +11,16 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "title-numeric-asc": function ( a, b ) {
+ "title-numeric-pre": function ( a ) {
var x = a.match(/title="*(-?[0-9\.]+)/)[1];
- var y = b.match(/title="*(-?[0-9\.]+)/)[1];
- x = parseFloat( x );
- y = parseFloat( y );
+ return parseFloat( x );
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "title-numeric-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-numeric-desc": function ( a, b ) {
- var x = a.match(/title="*(-?[0-9\.]+)/)[1];
- var y = b.match(/title="*(-?[0-9\.]+)/)[1];
- x = parseFloat( x );
- y = parseFloat( y );
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );
diff --git a/sorting/title-string.js b/sorting/title-string.js
index 01c231c..2e806bd 100644
--- a/sorting/title-string.js
+++ b/sorting/title-string.js
@@ -8,17 +8,15 @@
*/
jQuery.extend( jQuery.fn.dataTableExt.oSort, {
- "title-string-asc": function ( a, b ) {
- var x = a.match(/title="(.*?)"/)[1].toLowerCase();
- var y = b.match(/title="(.*?)"/)[1].toLowerCase();
+ "title-string-pre": function ( a ) {
+ return a.match(/title="(.*?)"/)[1].toLowerCase();
+ },
- return ((x < y) ? -1 : ((x > y) ? 1 : 0));
+ "title-string-asc": function ( a, b ) {
+ return ((a < b) ? -1 : ((a > b) ? 1 : 0));
},
"title-string-desc": function ( a, b ) {
- var x = a.match(/title="(.*?)"/)[1].toLowerCase();
- var y = b.match(/title="(.*?)"/)[1].toLowerCase();
-
- return ((x < y) ? 1 : ((x > y) ? -1 : 0));
+ return ((a < b) ? 1 : ((a > b) ? -1 : 0));
}
} );