kitten-format
Advanced tools
Comparing version 1.13.0 to 1.14.0
@@ -56,3 +56,4 @@ (function (global, factory) { | ||
MAD : 'MAD', | ||
EGP : 'E £' | ||
EGP : 'E £', | ||
CLP : '$', | ||
}; | ||
@@ -59,0 +60,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).kittenFormat=r()}(this,function(){"use strict";function e(e){return null==e||"string"!=typeof e?e:e.toLowerCase()}var r={EUR:"€",GBP:"£",CHF:"franc",USD:"$",AED:"DH",SAR:"riyāl",XPF:"F",MAD:"MAD",EGP:"E £"},t={locale:"fr-FR",currency:"EUR",currencySymbol:r.EUR,precision:2,unitPrefixes:{15:{default:"P",g:"GT"},12:{default:"T",g:"MT"},9:{default:"G",g:"kT"},6:{default:"M",g:"T"},3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","},n={default:t};function i(e){e&&(n.default=e)}function u(e){return n[e]?n[e]:n.default}function o(e,r,t){e=u(e);let n=(r+="").split("."),i=n[0],o=n[1]||"",l=e.thousandSeparator||" ",c=0,a="";"0"!==o[o.length-1]&&!0!==t.shouldNotRound&&(o=function(e,r){var t=Math.pow(10,r);return Math.round(e*t)/t}(Number("0."+o,10),null!=t.maximumFractionDigits?t.maximumFractionDigits:e.precision)+"",1===Number(o)&&(i=Number(i)+1+""),o=o.slice(2));const s="-"===i[0]?1:0;for(let e=i.length-1;e>=0;e--)a=i[e]+a,3===++c&&e-1>=s&&(a=l+a,c=0);if(null!=t.minimumFractionDigits)for(o+="";o.length<t.minimumFractionDigits;o+="0");return!0===t.shouldNotRound&&(o=o.slice(0,null!=t.maximumFractionDigits?t.maximumFractionDigits:o.length)),o.length&&(a+=e.decimalSeparator+o),"currency"===t.style&&(!0===e.isCurrencyFirst?a=(t.unitPrefix||"")+e.currencySymbol+a:a+=" "+(t.unitPrefix||"")+e.currencySymbol),a}function l(e,r){let t=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.precision;r.shouldNotRound||null!=n||(n=t.precision);return{locale:r.locale||t.locale,precision:n}}(e,r);return null==t||"object"!=typeof t?t:((r=r||{}).maximumFractionDigits=t.precision,o(t.locale,e,r))}function c(e,r){let t=a(e,r);return null==t||"object"!=typeof t?t:(r=r||{},(e=l(t.value,r))+" "+t.unit)}function a(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=null===(r=r||{}).power||void 0===r.power?0:r.power,n=r.unit;if(null==n)return e;var i=e,o=0,l=null;if(e>=1){var c=(e+"").split(".")[0].length;o=3*Math.trunc(c/3),null!==r.maxPower&&void 0!==r.maxPower&&o+t>r.maxPower&&(l=r.maxPower-t),i=e*Math.pow(10,-(null!==l?l:o))}i<1&&0!==i&&(i*=Math.pow(10,3),-0===(t-=3)&&(t=0));var a=u(r.locale).unitPrefixes[(null!==l?l:o)+t];return void 0===a?a="10^"+(o+t)+n:"string"!=typeof a?a=a[n]||a.default:a+=n,{value:i,unit:a}}function s(e,r){let t=f(e,r);return null==t||"object"!=typeof t?t:(t.precision<2&&(t.precision=2),t.style="currency",t.minimumFractionDigits=t.precision,null==t.minimumFractionDigits&&(t.minimumFractionDigits=t.locale.precision),t.maximumFractionDigits=t.minimumFractionDigits,o(t.locale,t.value,t))}function f(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.shouldNotRound?r.precision:r.precision||t.precision,i=r.currency||r.source||t.currency,o=r.locale||t.locale;return r.target&&r.rates&&r.rates[r.target]&&(r.source=i,i=r.target,e=m(e,r)),{locale:o,currency:i,precision:n,value:e,shouldNotRound:r.shouldNotRound}}function m(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.source||t.currency,i=r.target,o=r.rates;return!i||!o||o&&!o[n]||o&&!o[i]?e:e/o[n]*o[i]}function p(e,r){r||(r={}),r.unit="",r.maxPower=3;const t=a(e,r);let n=f(e,r);return null==n||"object"!=typeof n?n:(n.unitPrefix=t.unit,n.style="currency",o(n.locale,t.value,n))}const y={};return y.setOptions=i,y.setOption=function(e,i){null!=e&&("currency"===e&&(n.default.currencySymbol=r[i]||t.currencySymbol),n.default[e]=i)},y.locale=function(e){e&&(n[e.locale]=e,i(n[e.locale]))},y.lowerCase=e,y.upperCase=function(e){return null==e||"string"!=typeof e?e:e.toUpperCase()},y.upperCaseFirstChar=function(r){return null!=r&&"string"==typeof r&&r.length?r[0].toUpperCase()+e(r.slice(1,r.length)):r},y.formatN=l,y.formatNumber=l,y.percent=function(e,r){let t=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=100*e;return r&&r.isAlreadyPercentageNumber&&(t=e),{value:t}}(e,r);return null==t||"object"!=typeof t?t:l(t.value,r)+"%"},y.averageN=c,y.averageNumber=c,y.getCurrencySymbol=function(e){let t=r[e];return t||u("default").currencySymbol},y.formatC=s,y.formatCurrency=s,y.convC=m,y.convertCurrency=m,y.averageC=p,y.averageCurrency=p,y}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e=e||self).kittenFormat=r()}(this,function(){"use strict";function e(e){return null==e||"string"!=typeof e?e:e.toLowerCase()}var r={EUR:"€",GBP:"£",CHF:"franc",USD:"$",AED:"DH",SAR:"riyāl",XPF:"F",MAD:"MAD",EGP:"E £",CLP:"$"},t={locale:"fr-FR",currency:"EUR",currencySymbol:r.EUR,precision:2,unitPrefixes:{15:{default:"P",g:"GT"},12:{default:"T",g:"MT"},9:{default:"G",g:"kT"},6:{default:"M",g:"T"},3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","},n={default:t};function i(e){e&&(n.default=e)}function u(e){return n[e]?n[e]:n.default}function o(e,r,t){e=u(e);let n=(r+="").split("."),i=n[0],o=n[1]||"",l=e.thousandSeparator||" ",c=0,a="";"0"!==o[o.length-1]&&!0!==t.shouldNotRound&&(o=function(e,r){var t=Math.pow(10,r);return Math.round(e*t)/t}(Number("0."+o,10),null!=t.maximumFractionDigits?t.maximumFractionDigits:e.precision)+"",1===Number(o)&&(i=Number(i)+1+""),o=o.slice(2));const s="-"===i[0]?1:0;for(let e=i.length-1;e>=0;e--)a=i[e]+a,3===++c&&e-1>=s&&(a=l+a,c=0);if(null!=t.minimumFractionDigits)for(o+="";o.length<t.minimumFractionDigits;o+="0");return!0===t.shouldNotRound&&(o=o.slice(0,null!=t.maximumFractionDigits?t.maximumFractionDigits:o.length)),o.length&&(a+=e.decimalSeparator+o),"currency"===t.style&&(!0===e.isCurrencyFirst?a=(t.unitPrefix||"")+e.currencySymbol+a:a+=" "+(t.unitPrefix||"")+e.currencySymbol),a}function l(e,r){let t=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.precision;r.shouldNotRound||null!=n||(n=t.precision);return{locale:r.locale||t.locale,precision:n}}(e,r);return null==t||"object"!=typeof t?t:((r=r||{}).maximumFractionDigits=t.precision,o(t.locale,e,r))}function c(e,r){let t=a(e,r);return null==t||"object"!=typeof t?t:(r=r||{},(e=l(t.value,r))+" "+t.unit)}function a(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=null===(r=r||{}).power||void 0===r.power?0:r.power,n=r.unit;if(null==n)return e;var i=e,o=0,l=null;if(e>=1){var c=(e+"").split(".")[0].length;o=3*Math.trunc(c/3),null!==r.maxPower&&void 0!==r.maxPower&&o+t>r.maxPower&&(l=r.maxPower-t),i=e*Math.pow(10,-(null!==l?l:o))}i<1&&0!==i&&(i*=Math.pow(10,3),-0===(t-=3)&&(t=0));var a=u(r.locale).unitPrefixes[(null!==l?l:o)+t];return void 0===a?a="10^"+(o+t)+n:"string"!=typeof a?a=a[n]||a.default:a+=n,{value:i,unit:a}}function s(e,r){let t=f(e,r);return null==t||"object"!=typeof t?t:(t.precision<2&&(t.precision=2),t.style="currency",t.minimumFractionDigits=t.precision,null==t.minimumFractionDigits&&(t.minimumFractionDigits=t.locale.precision),t.maximumFractionDigits=t.minimumFractionDigits,o(t.locale,t.value,t))}function f(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.shouldNotRound?r.precision:r.precision||t.precision,i=r.currency||r.source||t.currency,o=r.locale||t.locale;return r.target&&r.rates&&r.rates[r.target]&&(r.source=i,i=r.target,e=m(e,r)),{locale:o,currency:i,precision:n,value:e,shouldNotRound:r.shouldNotRound}}function m(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=u((r=r||{}).locale),n=r.source||t.currency,i=r.target,o=r.rates;return!i||!o||o&&!o[n]||o&&!o[i]?e:e/o[n]*o[i]}function p(e,r){r||(r={}),r.unit="",r.maxPower=3;const t=a(e,r);let n=f(e,r);return null==n||"object"!=typeof n?n:(n.unitPrefix=t.unit,n.style="currency",o(n.locale,t.value,n))}const y={};return y.setOptions=i,y.setOption=function(e,i){null!=e&&("currency"===e&&(n.default.currencySymbol=r[i]||t.currencySymbol),n.default[e]=i)},y.locale=function(e){e&&(n[e.locale]=e,i(n[e.locale]))},y.lowerCase=e,y.upperCase=function(e){return null==e||"string"!=typeof e?e:e.toUpperCase()},y.upperCaseFirstChar=function(r){return null!=r&&"string"==typeof r&&r.length?r[0].toUpperCase()+e(r.slice(1,r.length)):r},y.formatN=l,y.formatNumber=l,y.percent=function(e,r){let t=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=100*e;return r&&r.isAlreadyPercentageNumber&&(t=e),{value:t}}(e,r);return null==t||"object"!=typeof t?t:l(t.value,r)+"%"},y.averageN=c,y.averageNumber=c,y.getCurrencySymbol=function(e){let t=r[e];return t||u("default").currencySymbol},y.formatC=s,y.formatCurrency=s,y.convC=m,y.convertCurrency=m,y.averageC=p,y.averageCurrency=p,y}); |
@@ -52,3 +52,4 @@ 'use strict'; | ||
MAD : 'MAD', | ||
EGP : 'E £' | ||
EGP : 'E £', | ||
CLP : '$', | ||
}; | ||
@@ -55,0 +56,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("kitten-format")):"function"==typeof define&&define.amd?define(["kitten-format"],t):(e=e||self).kittenFormat_ar_MA=t(e.kittenFormat)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t={locale:"ar-MA",currency:"DH",currencySymbol:{EUR:"€",GBP:"£",CHF:"franc",USD:"$",AED:"DH",SAR:"riyāl",XPF:"F",MAD:"MAD",EGP:"E £"}.DH,precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return e.locale(t),t}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("kitten-format")):"function"==typeof define&&define.amd?define(["kitten-format"],t):(e=e||self).kittenFormat_ar_MA=t(e.kittenFormat)}(this,function(e){"use strict";e=e&&e.hasOwnProperty("default")?e.default:e;var t={locale:"ar-MA",currency:"DH",currencySymbol:{EUR:"€",GBP:"£",CHF:"franc",USD:"$",AED:"DH",SAR:"riyāl",XPF:"F",MAD:"MAD",EGP:"E £",CLP:"$"}.DH,precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return e.locale(t),t}); |
@@ -33,2 +33,3 @@ # kitten-format | ||
Spanish (Spain) | `es-ES` | ||
Spanish (Chile) | `es-CL` | ||
French (Switzerland) | `fr-CH` | ||
@@ -35,0 +36,0 @@ French (France) | `fr-FR` |
@@ -10,3 +10,4 @@ export default { | ||
MAD : 'MAD', | ||
EGP : 'E £' | ||
EGP : 'E £', | ||
CLP : '$', | ||
} |
{ | ||
"name": "kitten-format", | ||
"version": "1.13.0", | ||
"version": "1.14.0", | ||
"description": "Fast formatters for browsers", | ||
@@ -5,0 +5,0 @@ "main": "build/kittenFormat.server.js", |
@@ -33,2 +33,3 @@ # kitten-format | ||
Spanish (Spain) | `es-ES` | ||
Spanish (Chile) | `es-CL` | ||
French (Switzerland) | `fr-CH` | ||
@@ -35,0 +36,0 @@ French (France) | `fr-FR` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Mixed license
License(Experimental) Package contains multiple licenses.
Found 1 instance in 1 package
0
2763
290
107192
53
15