1
0
mirror of synced 2024-11-17 03:27:13 +01:00

Tidied _numericSort and added @author tag

This commit is contained in:
n1474335 2017-06-01 10:21:10 +00:00
parent c6391d958d
commit ea3630e018

View File

@ -223,9 +223,11 @@ const SeqUtils = {
return a_ - b_;
},
/**
* Comparison operation for sorting of numeric values.
*
* @author Chris van Marle
* @private
* @param {string} a
* @param {string} b
@ -235,7 +237,7 @@ const SeqUtils = {
let a_ = a.split(/([^\d]+)/),
b_ = b.split(/([^\d]+)/);
for (let i=0; i<a_.length && i<b.length; ++i) {
for (let i = 0; i < a_.length && i < b.length; ++i) {
if (isNaN(a_[i]) && !isNaN(b_[i])) return 1; // Numbers after non-numbers
if (!isNaN(a_[i]) && isNaN(b_[i])) return -1;
if (isNaN(a_[i]) && isNaN(b_[i])) {