You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Plugins/sorting/any-number.min.mjs

2 lines
564 B
JavaScript

/*! © SpryMedia Ltd, David Konrad - datatables.net/license */
import DataTable from"datatables.net";function _anyNumberSort(a,e,r){var t=/[+-]?((\d+(\.\d*)?)|\.\d+)([eE][+-]?[0-9]+)?/;return(a=null!==(a=a.replace(",",".").match(t))?parseFloat(a[0]):r)<(e=null!==(e=e.replace(",",".").match(t))?parseFloat(e[0]):r)?-1:e<a?1:0}DataTable.ext.order["any-number-asc"]=function(a,e){return _anyNumberSort(a,e,Number.POSITIVE_INFINITY)},DataTable.ext.order["any-number-desc"]=function(a,e){return-1*_anyNumberSort(a,e,Number.NEGATIVE_INFINITY)};export default DataTable;