mirror of
https://github.com/Mottie/tablesorter.git
synced 2024-12-05 05:04:20 +00:00
2 lines
1.6 KiB
JavaScript
2 lines
1.6 KiB
JavaScript
/*! Parser: namedNumbers - updated 10/26/2014 (v2.18.0) */
|
|
!function(e){"use strict";var i,n,t={negative:["negative","minus"],numbers:{zero:0,one:1,two:2,three:3,four:4,five:5,six:6,seven:7,eight:8,nine:9,ten:10,eleven:11,twelve:12,thirteen:13,fourteen:14,fifteen:15,sixteen:16,seventeen:17,eighteen:18,nineteen:19,twenty:20,thirty:30,forty:40,fourty:40,fifty:50,sixty:60,seventy:70,eighty:80,ninety:90},hundred:"hundred",powers:{thousand:1e3,million:1e6,billion:1e9,trillion:1e12,quadrillion:1e15,quintillion:1e18,sextillion:1e21,septillion:1e24,octillion:1e27,nonillion:1e30,decillion:1e33,undecillion:1e36,duodecillion:1e39,tredecillion:1e42,quattuordecillion:1e45,quindecillion:1e48,sexdecillion:1e51,septendecillion:1e54,octodecillion:1e57,novemdecillion:1e60,vigintillion:1e63,unvigintillion:1e66,duovigintillion:1e69,trevigintillion:1e72,quattuorvigintillion:1e75,quinvigintillion:1e78,sexvigintillion:1e81,septenvigintillion:1e84,octovigintillion:1e87,novemvigintillion:1e90,trigintillion:1e93,untrigintillion:1e96,duotrigintillion:1e99,googl:1e100}},l=new RegExp("("+t.negative.join("|")+")"),o=function(l,o){var r=l.replace(/[,."']/g,""),u=e.tablesorter.formatFloat(l||"",o),s=t.powers.hasOwnProperty(r)?t.powers[r]:null;null!==(u="number"==typeof u?u:t.numbers.hasOwnProperty(r)?t.numbers[r]:null)?n+=u:r===t.hundred?n*=100:null!==s&&(i+=n*s,n=0)};e.tablesorter.addParser({id:"namedNumbers",is:function(){return!1},format:function(r,u){i=0,n=0;var s,a=(r||"").split(/[\s-]+/),d=a.length;for(s=0;s<d;s++)o(a[s].toLowerCase(),u);return i=(i+n)*(r.match(l)?-1:1),i||t.numbers.hasOwnProperty(r)?i:e.tablesorter.formatFloat(r||"",u)},type:"numeric"})}(jQuery); |