mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-11-15 23:54:22 +00:00
Parser: Add huge number parser. See #1161
This commit is contained in:
parent
b31a1a61cd
commit
b0b912ae35
2
dist/js/parsers/parser-huge-numbers.min.js
vendored
Normal file
2
dist/js/parsers/parser-huge-numbers.min.js
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
/*! Parser: hugeNumbers - updated 2/23/2016 (v2.25.5) */
|
||||
!function(a){"use strict";a.tablesorter.addParser({id:"hugeNumbers",is:function(){return!1},format:function(a){return a.replace(/\B(?=(\d{12})+(?!\d))/g,",")},type:"text"})}(jQuery);
|
21
js/parsers/parser-huge-numbers.js
Normal file
21
js/parsers/parser-huge-numbers.js
Normal file
@ -0,0 +1,21 @@
|
||||
/*! Parser: hugeNumbers - updated 2/23/2016 (v2.25.5) *//*
|
||||
* See https://github.com/Mottie/tablesorter/issues/1161
|
||||
*/
|
||||
/*jshint jquery:true */
|
||||
;( function( $ ) {
|
||||
'use strict';
|
||||
|
||||
$.tablesorter.addParser({
|
||||
id: 'hugeNumbers',
|
||||
is : function() {
|
||||
return false;
|
||||
},
|
||||
format : function( str ) {
|
||||
// add commas every 12 digits; Number.MAX_SAFE_INTEGER is 16 digits long
|
||||
// regex modified from: http://stackoverflow.com/a/2901298/145346
|
||||
return str.replace(/\B(?=(\d{12})+(?!\d))/g, ",");
|
||||
},
|
||||
type : 'text'
|
||||
});
|
||||
|
||||
})( jQuery );
|
Loading…
Reference in New Issue
Block a user