kitten-format
Advanced tools
Comparing version 1.6.3 to 1.7.0
@@ -7,7 +7,54 @@ (function (global, factory) { | ||
/** | ||
* Lower case a string | ||
* @param {String} value | ||
* @returns {String} | ||
*/ | ||
function lowerCase (value) { | ||
if (value === null || value === undefined || typeof value !== 'string') { | ||
return value; | ||
} | ||
return value.toLowerCase(); | ||
} | ||
/** | ||
* Upper case a string | ||
* @param {String} value | ||
* @returns {String} | ||
*/ | ||
function upperCase (value) { | ||
if (value === null || value === undefined || typeof value !== 'string') { | ||
return value; | ||
} | ||
return value.toUpperCase(); | ||
} | ||
/** | ||
* Upper case first character of a string | ||
* @param {String} value | ||
* @returns {String} | ||
*/ | ||
function upperCaseFirstChar (value) { | ||
if (value === null || value === undefined || typeof value !== 'string' || !value.length) { | ||
return value; | ||
} | ||
return value[0].toUpperCase() + lowerCase(value.slice(1, value.length)); | ||
} | ||
var kittenFormat = {}; | ||
kittenFormat.lowerCase = lowerCase; | ||
kittenFormat.upperCase = upperCase; | ||
kittenFormat.upperCaseFirstChar = upperCaseFirstChar; | ||
var defaultLocale = { | ||
locale : 'fr-FR', | ||
currency : 'EUR', | ||
precision : 2, | ||
unitPrefixes : { | ||
locale : 'fr-FR', | ||
currency : 'EUR', | ||
currencySymbol : '€', | ||
precision : 2, | ||
unitPrefixes : { | ||
15 : { default : 'P', g : 'GT' }, | ||
@@ -22,3 +69,5 @@ 12 : { default : 'T', g : 'MT' }, | ||
'-9' : 'n' | ||
} | ||
}, | ||
thousandSeparator : ' ', | ||
decimalSeparator : ',' | ||
}; | ||
@@ -108,2 +157,69 @@ | ||
/** | ||
* Format currency | ||
* @param {Number} value | ||
* @param {Object} options | ||
* @returns {String} | ||
*/ | ||
function formatC (value, options) { | ||
if (value == null) { | ||
return value; | ||
} | ||
if (typeof value === 'string' && isNaN(value)) { | ||
return '-'; | ||
} | ||
options = options || {}; | ||
var _localeOptions = getLocale(options.locale); | ||
var _precision = options.precision || _localeOptions.precision; | ||
var _currency = options.currency || options.source || _localeOptions.currency; | ||
var _locale = options.locale || _localeOptions.locale; | ||
// If options target is defined, we need to convert | ||
if (options.target && options.rates && options.rates[options.target]) { | ||
options.source = _currency; | ||
_currency = options.target; | ||
value = convC(value, options); | ||
} | ||
return { | ||
locale : _locale, | ||
currency : _currency, | ||
precision : _precision, | ||
value : value | ||
}; | ||
} | ||
/** | ||
* Convert currency | ||
* @param {Number} value | ||
* @param {Object} options | ||
* @returns {Number} | ||
*/ | ||
function convC (value, options) { | ||
if (value == null) { | ||
return value; | ||
} | ||
if (typeof value === 'string' && isNaN(value)) { | ||
return '-'; | ||
} | ||
options = options || {}; | ||
var _localeOptions = getLocale(options.locale); | ||
var _source = options.source || _localeOptions.currency; | ||
var _target = options.target; | ||
var _rates = options.rates; | ||
if (!_target || !_rates || (_rates && !_rates[_source]) || (_rates && !_rates[_target])) { | ||
return value; | ||
} | ||
var _value = value / _rates[_source]; | ||
return _value * _rates[_target]; | ||
} | ||
var registerdFormatters = {}; | ||
@@ -114,12 +230,13 @@ | ||
* @param {String} locale ex: 'fr-FR' | ||
* @param {String} currency ex: 'EUR' | ||
* @param {Int} precision ex: 2 | ||
* @param {Object} options | ||
* options.currency ex: 'EUR' | ||
* options.maximumFractionDigits | ||
* options.minimumFractionDigits | ||
* @returns {Intl} | ||
*/ | ||
function getFormatter (locale$$1, precision) { | ||
var _key = locale$$1 + ':' + precision; | ||
function getFormatter (locale, options) { | ||
var _key = locale + ':' + (Object.values(options).join(':')); | ||
if (!registerdFormatters[_key]) { | ||
registerdFormatters[_key] = new Intl.NumberFormat(locale$$1, { | ||
maximumFractionDigits : precision | ||
}); | ||
registerdFormatters[_key] = new Intl.NumberFormat(locale, options); | ||
} | ||
@@ -131,2 +248,26 @@ | ||
/** | ||
* Format currency | ||
* @param {Number} value | ||
* @param {Object} options | ||
* @returns {String} | ||
*/ | ||
function formatC$1 (value, options) { | ||
let parameters = formatC(value, options); | ||
if (parameters == null || typeof parameters !== 'object') { | ||
return parameters; | ||
} | ||
if (parameters.precision < 2) { | ||
parameters.precision = 2; | ||
} | ||
return getFormatter(parameters.locale, { | ||
style : 'currency', | ||
currency : parameters.currency, | ||
minimumFractionDigits : parameters.precision | ||
}).format(parameters.value); | ||
} | ||
/** | ||
* Format number | ||
@@ -138,3 +279,3 @@ * @param {Number} value | ||
function formatN (value, options) { | ||
if (value === undefined || value === null) { | ||
if (value == null) { | ||
return value | ||
@@ -153,3 +294,6 @@ } | ||
return getFormatter(_locale, _precision).format(value); | ||
return { | ||
locale : _locale, | ||
precision : _precision | ||
} | ||
} | ||
@@ -164,3 +308,3 @@ | ||
function averageN (value, options) { | ||
if (value === undefined || value === null) { | ||
if (value == null) { | ||
return value; | ||
@@ -209,4 +353,2 @@ } | ||
var _unitPrefixes = _localeOptions.unitPrefixes; | ||
var _result = formatN(_value, options); | ||
var _unitPrefix = _unitPrefixes[(_displayPower !== null ? _displayPower : _averagePower) + _power]; | ||
@@ -224,3 +366,6 @@ | ||
return _result + ' ' + _unitPrefix; | ||
return { | ||
value : _value, | ||
unit : _unitPrefix | ||
} | ||
} | ||
@@ -231,6 +376,5 @@ | ||
* @param {Number} value | ||
* @param {Object} options | ||
*/ | ||
function percent (value, options) { | ||
if (value === undefined || value === null) { | ||
function percent (value) { | ||
if (value == null) { | ||
return value; | ||
@@ -249,85 +393,28 @@ } | ||
return formatN(_value, options) + '%'; | ||
return { | ||
value : _value | ||
}; | ||
} | ||
/** | ||
* Lower case a string | ||
* @param {String} value | ||
* @returns {String} | ||
* Format number | ||
* @param {Number} value | ||
* @param {Object} options | ||
* @return {String} | ||
*/ | ||
function lowerCase (value) { | ||
if (value === null || value === undefined || typeof value !== 'string') { | ||
return value; | ||
} | ||
function formatN$1 (value, options) { | ||
let parameters = formatN(value, options); | ||
return value.toLowerCase(); | ||
} | ||
/** | ||
* Upper case a string | ||
* @param {String} value | ||
* @returns {String} | ||
*/ | ||
function upperCase (value) { | ||
if (value === null || value === undefined || typeof value !== 'string') { | ||
return value; | ||
if (parameters == null || typeof parameters !== 'object') { | ||
return parameters; | ||
} | ||
return value.toUpperCase(); | ||
} | ||
Object.assign(parameters, options); | ||
parameters.maximumFractionDigits = parameters.precision; | ||
/** | ||
* Upper case first character of a string | ||
* @param {String} value | ||
* @returns {String} | ||
*/ | ||
function upperCaseFirstChar (value) { | ||
if (value === null || value === undefined || typeof value !== 'string' || !value.length) { | ||
return value; | ||
} | ||
return value[0].toUpperCase() + lowerCase(value.slice(1, value.length)); | ||
return getFormatter(parameters.locale, parameters).format(value); | ||
} | ||
var kittenFormat = {}; | ||
kittenFormat.setOptions = setOptions; | ||
kittenFormat.setOption = setOption; | ||
kittenFormat.locale = locale; | ||
kittenFormat.averageN = averageN; | ||
kittenFormat.averageNumber = averageN; | ||
kittenFormat.lowerCase = lowerCase; | ||
kittenFormat.upperCase = upperCase; | ||
kittenFormat.upperCaseFirstChar = upperCaseFirstChar; | ||
var registerdFormatters$1 = {}; | ||
/** | ||
* Get formatter instance | ||
* @param {String} locale ex: 'fr-FR' | ||
* @param {String} currency ex: 'EUR' | ||
* @param {Int} precision ex: 2 | ||
* @returns {Intl} | ||
*/ | ||
function getFormatter$1 (locale$$1, currency, precision) { | ||
if (precision < 2) { | ||
precision = 2; | ||
} | ||
var _key = locale$$1 + ':' + currency + ':' + precision; | ||
if (!registerdFormatters$1[_key]) { | ||
registerdFormatters$1[_key] = new Intl.NumberFormat(locale$$1, { | ||
minimumFractionDigits : precision, | ||
currency : currency, | ||
style : 'currency' | ||
}); | ||
} | ||
return registerdFormatters$1[_key]; | ||
} | ||
/** | ||
* Format currency | ||
* Average a number | ||
* @param {Number} value | ||
@@ -337,66 +424,43 @@ * @param {Object} options | ||
*/ | ||
function formatC (value, options) { | ||
if (value === null || value === undefined) { | ||
return value; | ||
} | ||
function averageN$1 (value, options) { | ||
let parameters = averageN(value, options); | ||
if (typeof value === 'string' && isNaN(value)) { | ||
return '-'; | ||
if (parameters == null || typeof parameters !== 'object') { | ||
return parameters; | ||
} | ||
options = options || {}; | ||
value = formatN$1(parameters.value, options); | ||
var _localeOptions = getLocale(options.locale); | ||
var _precision = options.precision || _localeOptions.precision; | ||
var _currency = options.currency || options.source || _localeOptions.currency; | ||
var _locale = options.locale || _localeOptions.locale; | ||
// If options target is defined, we need to convert | ||
if (options.target && options.rates && options.rates[options.target]) { | ||
options.source = _currency; | ||
_currency = options.target; | ||
value = convC(value, options); | ||
} | ||
return getFormatter$1(_locale, _currency, _precision).format(value); | ||
return value + ' ' + parameters.unit; | ||
} | ||
/** | ||
* Convert currency | ||
* Set a number as a percentage | ||
* @param {Number} value | ||
* @param {Object} options | ||
* @returns {Number} | ||
*/ | ||
function convC (value, options) { | ||
if (value === null || value === undefined) { | ||
return value; | ||
} | ||
function percent$1 (value, options) { | ||
let parameters = percent(value); | ||
if (typeof value === 'string' && isNaN(value)) { | ||
return '-'; | ||
if (parameters == null || typeof parameters !== 'object') { | ||
return parameters; | ||
} | ||
options = options || {}; | ||
return formatN$1(parameters.value, options) + '%'; | ||
} | ||
var _localeOptions = getLocale(options.locale); | ||
var _source = options.source || _localeOptions.currency; | ||
var _target = options.target; | ||
var _rates = options.rates; | ||
kittenFormat.setOptions = setOptions; | ||
kittenFormat.setOption = setOption; | ||
kittenFormat.locale = locale; | ||
if (!_target || !_rates || (_rates && !_rates[_source]) || (_rates && !_rates[_target])) { | ||
return value; | ||
} | ||
var _value = value / _rates[_source]; | ||
return _value * _rates[_target]; | ||
} | ||
kittenFormat.formatC = formatC; | ||
kittenFormat.formatCurrency = formatC; | ||
kittenFormat.formatC = formatC$1; | ||
kittenFormat.formatCurrency = formatC$1; | ||
kittenFormat.convC = convC; | ||
kittenFormat.convertCurrency = convC; | ||
kittenFormat.formatN = formatN; | ||
kittenFormat.formatNumber = formatN; | ||
kittenFormat.percent = percent; | ||
kittenFormat.formatN = formatN$1; | ||
kittenFormat.formatNumber = formatN$1; | ||
kittenFormat.percent = percent$1; | ||
kittenFormat.averageN = averageN$1; | ||
kittenFormat.averageNumber = averageN$1; | ||
@@ -403,0 +467,0 @@ return kittenFormat; |
@@ -1,1 +0,1 @@ | ||
!function(r,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(r=r||self).kittenFormat=e()}(this,function(){"use strict";var r={default:{locale:"fr-FR",currency:"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"}}};function e(e){r.default=e}function n(e){return r[e]?r[e]:r.default}var t={};function a(r,e){if(null==r)return r;if("string"==typeof r&&isNaN(r))return"-";var a,u,o,i=n((e=e||{}).locale),l=e.precision||i.precision,f=e.locale||i.locale;return(a=f,u=l,o=a+":"+u,t[o]||(t[o]=new Intl.NumberFormat(a,{maximumFractionDigits:u})),t[o]).format(r)}function u(r,e){if(null==r)return r;if("string"==typeof r&&isNaN(r))return"-";var t=null===(e=e||{}).power||void 0===e.power?0:e.power,u=e.unit;if(!u)return r;var o=r,i=0,l=null;if(r>=1){var f=(r+"").split(".")[0].length;i=3*Math.trunc(f/3),null!==e.maxPower&&void 0!==e.maxPower&&i+t>e.maxPower&&(l=e.maxPower-t),o=r*Math.pow(10,-(null!==l?l:i))}o<1&&(o*=Math.pow(10,3),-0===(t-=3)&&(t=0));var c=n(e.locale).unitPrefixes,s=a(o,e),g=c[(null!==l?l:i)+t];return void 0===g?g="10^"+(i+t)+u:"string"!=typeof g?g=g[u]||g.default:g+=u,s+" "+g}function o(r){return null==r||"string"!=typeof r?r:r.toLowerCase()}var i={};i.setOptions=e,i.setOption=function(e,n){r.default[e]=n},i.locale=function(n){if(n){r[n.locale]=n;var t=function(){var r=null;r=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.userLanguage?navigator.userLanguage:navigator.language;var e={en:"en-GB",fr:"fr-FR"};return e[r]&&(r=e[r]),r}();t!==r.default.locale&&r[t]&&e(r[t])}},i.averageN=u,i.averageNumber=u,i.lowerCase=o,i.upperCase=function(r){return null==r||"string"!=typeof r?r:r.toUpperCase()},i.upperCaseFirstChar=function(r){return null!=r&&"string"==typeof r&&r.length?r[0].toUpperCase()+o(r.slice(1,r.length)):r};var l={};function f(r,e){if(null==r)return r;if("string"==typeof r&&isNaN(r))return"-";var t=n((e=e||{}).locale),a=e.precision||t.precision,u=e.currency||e.source||t.currency,o=e.locale||t.locale;return e.target&&e.rates&&e.rates[e.target]&&(e.source=u,u=e.target,r=c(r,e)),function(r,e,n){n<2&&(n=2);var t=r+":"+e+":"+n;return l[t]||(l[t]=new Intl.NumberFormat(r,{minimumFractionDigits:n,currency:e,style:"currency"})),l[t]}(o,u,a).format(r)}function c(r,e){if(null==r)return r;if("string"==typeof r&&isNaN(r))return"-";var t=n((e=e||{}).locale),a=e.source||t.currency,u=e.target,o=e.rates;return!u||!o||o&&!o[a]||o&&!o[u]?r:r/o[a]*o[u]}return i.formatC=f,i.formatCurrency=f,i.convC=c,i.convertCurrency=c,i.formatN=a,i.formatNumber=a,i.percent=function(r,e){if(null==r)return r;if("string"==typeof r&&isNaN(r))return"-";var n=100*r;return r>1&&(n=r),a(n,e)+"%"},i}); | ||
!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={};r.lowerCase=e,r.upperCase=function(e){return null==e||"string"!=typeof e?e:e.toUpperCase()},r.upperCaseFirstChar=function(r){return null!=r&&"string"==typeof r&&r.length?r[0].toUpperCase()+e(r.slice(1,r.length)):r};var n={default:{locale:"fr-FR",currency:"EUR",currencySymbol:"€",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:","}};function t(e){n.default=e}function u(e){return n[e]?n[e]:n.default}function a(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var n=u((r=r||{}).locale),t=r.source||n.currency,a=r.target,o=r.rates;return!a||!o||o&&!o[t]||o&&!o[a]?e:e/o[t]*o[a]}var o={};function i(e,r){var n=e+":"+Object.values(r).join(":");return o[n]||(o[n]=new Intl.NumberFormat(e,r)),o[n]}function l(e,r){let n=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var n=u((r=r||{}).locale),t=r.precision||n.precision,o=r.currency||r.source||n.currency,i=r.locale||n.locale;return r.target&&r.rates&&r.rates[r.target]&&(r.source=o,o=r.target,e=a(e,r)),{locale:i,currency:o,precision:t,value:e}}(e,r);return null==n||"object"!=typeof n?n:(n.precision<2&&(n.precision=2),i(n.locale,{style:"currency",currency:n.currency,minimumFractionDigits:n.precision}).format(n.value))}function c(e,r){let n=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var n=u((r=r||{}).locale),t=r.precision||n.precision;return{locale:r.locale||n.locale,precision:t}}(e,r);return null==n||"object"!=typeof n?n:(Object.assign(n,r),n.maximumFractionDigits=n.precision,i(n.locale,n).format(e))}function f(e,r){let n=function(e,r){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var n=null===(r=r||{}).power||void 0===r.power?0:r.power,t=r.unit;if(!t)return e;var a=e,o=0,i=null;if(e>=1){var l=(e+"").split(".")[0].length;o=3*Math.trunc(l/3),null!==r.maxPower&&void 0!==r.maxPower&&o+n>r.maxPower&&(i=r.maxPower-n),a=e*Math.pow(10,-(null!==i?i:o))}a<1&&(a*=Math.pow(10,3),-0==(n-=3)&&(n=0));var c=u(r.locale).unitPrefixes[(null!==i?i:o)+n];return void 0===c?c="10^"+(o+n)+t:"string"!=typeof c?c=c[t]||c.default:c+=t,{value:a,unit:c}}(e,r);return null==n||"object"!=typeof n?n:(e=c(n.value,r))+" "+n.unit}return r.setOptions=t,r.setOption=function(e,r){n.default[e]=r},r.locale=function(e){if(e){n[e.locale]=e;var r=function(){var e=null;e=navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.userLanguage?navigator.userLanguage:navigator.language;var r={en:"en-GB",fr:"fr-FR"};return r[e]&&(e=r[e]),e}();r!==n.default.locale&&n[r]&&t(n[r])}},r.formatC=l,r.formatCurrency=l,r.convC=a,r.convertCurrency=a,r.formatN=c,r.formatNumber=c,r.percent=function(e,r){let n=function(e){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=100*e;return e>1&&(r=e),{value:r}}(e);return null==n||"object"!=typeof n?n:c(n.value,r)+"%"},r.averageN=f,r.averageNumber=f,r}); |
@@ -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_de_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"de-CH",currency:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_de_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"de-CH",currency:"CHF",currencySymbol:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
@@ -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_en_GB=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"en-GB",currency:"GBP",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_en_GB=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"en-GB",currency:"GBP",currencySymbol:"£",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:",",decimalSeparator:".",isCurrencyFirst:!0};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
@@ -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_es_ES=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"es-ES",currency:"EUR",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_es_ES=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"es-ES",currency:"EUR",currencySymbol:"€",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
@@ -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_fr_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"fr-CH",currency:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_fr_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"fr-CH",currency:"CHF",currencySymbol:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
@@ -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_fr_FR=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"fr-FR",currency:"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"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_fr_FR=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"fr-FR",currency:"EUR",currencySymbol:"€",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:","};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
@@ -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_it_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"it-CH",currency:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"}};return(e=e&&e.hasOwnProperty("default")?e.default: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_it_CH=t(e.kittenFormat)}(this,function(e){"use strict";var t={locale:"it-CH",currency:"CHF",currencySymbol:"CHF",precision:2,unitPrefixes:{15:"P",12:"T",9:"G",6:"M",3:"k",0:"","-3":"m","-6":"μ","-9":"n"},thousandSeparator:" ",decimalSeparator:","};return(e=e&&e.hasOwnProperty("default")?e.default:e).locale(t),t}); |
{ | ||
"name": "kitten-format", | ||
"version": "1.6.3", | ||
"version": "1.7.0", | ||
"description": "Fast formatters for browsers", | ||
"main": "kittenFormat.client.js", | ||
"main": "kittenFormat.server.js", | ||
"author": "Ideolys", | ||
@@ -7,0 +7,0 @@ "license": "Apache-2.0", |
@@ -58,3 +58,3 @@ # kitten-format | ||
```js | ||
kittenFormat.setOptions('currency', 'GBP'); | ||
kittenFormat.setOption('currency', 'GBP'); | ||
``` | ||
@@ -61,0 +61,0 @@ |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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 2 instances 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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
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
32467
13
792