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
656 B
JavaScript

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