Skip to content

Commit

Permalink
Merge pull request #132 from googled/patch-1
Browse files Browse the repository at this point in the history
Support numbers starting with a plus sign
  • Loading branch information
tristen authored May 27, 2017
2 parents 5445d89 + 5451027 commit 4a5d14e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/sorts/tablesort.number.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
};

Tablesort.extend('number', function(item) {
return item.match(/^-?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^-?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^-?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
return item.match(/^[-+]?[£\x24Û¢´€]?\d+\s*([,\.]\d{0,2})/) || // Prefixed currency
item.match(/^[-+]?\d+\s*([,\.]\d{0,2})?[£\x24Û¢´€]/) || // Suffixed currency
item.match(/^[-+]?(\d)*-?([,\.]){0,1}-?(\d)+([E,e][\-+][\d]+)?%?$/); // Number
}, function(a, b) {
a = cleanNumber(a);
b = cleanNumber(b);
Expand Down

0 comments on commit 4a5d14e

Please sign in to comment.