Merged in feature/plugins-update (pull request #9)

wp plugin updates from pantheon

* wp plugin updates from pantheon
This commit is contained in:
Tony Volpe
2023-12-15 18:08:21 +00:00
parent 28c21bf9b1
commit 779393381f
577 changed files with 154305 additions and 0 deletions

View File

@@ -0,0 +1,87 @@
/**
* Nummy.js - A (very) lightweight number formatter
* @link https://github.com/mgibbs189/nummy
*/
(function() {
function isValid(input) {
return !isNaN(parseFloat(input)) && isFinite(input);
}
function toFixed(value, precision) {
var pow = Math.pow(10, precision);
return (Math.round(value * pow) / pow).toFixed(precision);
}
class Nummy {
constructor(value) {
this._value = isValid(value) ? value : 0;
}
format(format, opts) {
var value = this._value,
negative = false,
precision = 0,
valueStr = '',
wholeStr = '',
decimalStr = '',
abbr = '';
var opts = Object.assign({}, {
'thousands_separator': ',',
'decimal_separator': '.'
}, opts);
if (-1 < format.indexOf('a')) {
var abbrevs = ['K', 'M', 'B', 't', 'q', 'Q'];
var exp = Math.floor(Math.log(Math.abs(value)) * Math.LOG10E); // log10 polyfill
var nearest_exp = (exp - (exp % 3)); // nearest exponent divisible by 3
if (3 <= exp) {
value = value / Math.pow(10, nearest_exp);
abbr += abbrevs[Math.floor(exp / 3) - 1];
}
format = format.replace('a', '');
}
// Check for decimals format
if (-1 < format.indexOf('.')) {
precision = format.split('.')[1].length;
}
value = toFixed(value, precision);
valueStr = value.toString();
// Handle negative number
if (value < 0) {
negative = true;
value = Math.abs(value);
valueStr = valueStr.slice(1);
}
wholeStr = valueStr.split('.')[0] || '';
decimalStr = valueStr.split('.')[1] || '';
// Handle decimals
decimalStr = (0 < precision && '' != decimalStr) ? '.' + decimalStr : '';
// Use thousands separators
if (-1 < format.indexOf(',')) {
wholeStr = wholeStr.replace(/(\d)(?=(\d{3})+(?!\d))/g, '$1,');
}
var output = (negative ? '-' : '') + wholeStr + decimalStr + abbr;
output = output.replace(/\./g, '{d}');
output = output.replace(/\,/g, '{t}');
output = output.replace(/{d}/g, opts.decimal_separator);
output = output.replace(/{t}/g, opts.thousands_separator);
return output;
}
}
window.nummy = function(input) {
return new Nummy(input);
}
})();

View File

@@ -0,0 +1 @@
!function(){"use strict";var a;(a=function(a){var t;this._value=(t=a,!isNaN(parseFloat(t))&&isFinite(t)?a:0)}).prototype.format=function(a,t){var e=this._value,r=!1,i=0,n="",o="",s="",l="";if(t=Object.assign({},{thousands_separator:",",decimal_separator:"."},t),-1<a.indexOf("a")){var p=Math.floor(Math.log(Math.abs(e))*Math.LOG10E),c=p-p%3;3<=p&&(e/=Math.pow(10,c),l+=["K","M","B","t","q","Q"][Math.floor(p/3)-1]),a=a.replace("a","")}-1<a.indexOf(".")&&(i=a.split(".")[1].length),e=function(a,t){var e=Math.pow(10,t);return(Math.round(a*e)/e).toFixed(t)}(e,i),n=e.toString(),e<0&&(r=!0,e=Math.abs(e),n=n.slice(1)),o=n.split(".")[0]||"",s=n.split(".")[1]||"",s=0<i&&""!=s?"."+s:"",-1<a.indexOf(",")&&(o=o.replace(/(\d)(?=(\d{3})+(?!\d))/g,"$1,"));var d=(r?"-":"")+o+s+l;return d=(d=(d=(d=d.replace(/\./g,"{d}")).replace(/\,/g,"{t}")).replace(/{d}/g,t.decimal_separator)).replace(/{t}/g,t.thousands_separator)},window.nummy=function(t){return new a(t)}}();