| 1 | /*! Parser: hugeNumbers - updated 3/1/2016 (v2.25.5) *//* |
| 2 | * See https://github.com/Mottie/tablesorter/issues/1161 |
| 3 | */ |
| 4 | /*jshint jquery:true */ |
| 5 | ;( function( $ ) { |
| 6 | 'use strict'; |
| 7 | |
| 8 | $.tablesorter.addParser({ |
| 9 | id: 'hugeNumbers', |
| 10 | is : function() { |
| 11 | return false; |
| 12 | }, |
| 13 | format : function( str ) { |
| 14 | // add commas every 12 digits; Number.MAX_SAFE_INTEGER is 16 digits long |
| 15 | // regex modified from: http://stackoverflow.com/a/2901298/145346 |
| 16 | return str.replace(/\B(?=(\d{12})+(?!\d))/g, ','); |
| 17 | }, |
| 18 | type : 'text' |
| 19 | }); |
| 20 | |
| 21 | })( jQuery ); |