Tidied _numericSort and added @author tag

feature-extract-files
n1474335 2017-06-01 10:21:10 +00:00
parent c6391d958d
commit ea3630e018
1 changed files with 3 additions and 1 deletions

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])) {