Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kitten-format

Package Overview
Dependencies
Maintainers
2
Versions
31
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kitten-format - npm Package Compare versions

Comparing version 1.8.2 to 1.8.3

10

kittenFormat.client.js

@@ -163,3 +163,3 @@ (function (global, factory) {

if (options.style === 'currency') {
if (options.style === 'currency' && options.shouldNotRound !== true) {
options.maximumFractionDigits = options.minimumFractionDigits;

@@ -179,2 +179,6 @@ if (options.minimumFractionDigits == null) {

if (options.shouldNotRound === true) {
fraction = fraction.slice(0, options.maximumFractionDigits ? options.maximumFractionDigits : fraction.length);
}
if (fraction.length) {

@@ -268,3 +272,3 @@ res += locale$$1.decimalSeparator + fraction;

var _localeOptions = getLocale(options.locale);
var _precision = options.precision || _localeOptions.precision;
var _precision = options.precision;
var _locale = options.locale || _localeOptions.locale;

@@ -413,3 +417,3 @@

var _localeOptions = getLocale(options.locale);
var _precision = options.precision || _localeOptions.precision;
var _precision = options.precision;
var _currency = options.currency || options.source || _localeOptions.currency;

@@ -416,0 +420,0 @@ var _locale = options.locale || _localeOptions.locale;

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).kittenFormat=t()}(this,function(){"use strict";function e(e){return null==e||"string"!=typeof e?e:e.toLowerCase()}var t={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 r(e){e&&(t.default=e)}function n(e){return t[e]?t[e]:t.default}function i(e,t,r){e=n(e);let i=(t+="").split("."),o=i[0],u=i[1]||"",l=e.thousandSeparator||" ",a=0,c="";for(let e=o.length-1;e>=0;e--)c=o[e]+c,3===++a&&e-1>=0&&(c=l+c,a=0);if("currency"===r.style&&(r.maximumFractionDigits=r.minimumFractionDigits,null==r.minimumFractionDigits&&(r.minimumFractionDigits=e.precision)),"0"!==u[u.length-1]&&!0!==r.shouldNotRound&&(u=(function(e,t){var r=Math.pow(10,t);return Math.round(e*r)/r}(Number("0."+u,10),r.maximumFractionDigits?r.maximumFractionDigits:e.precision)+"").slice(2)),null!=r.minimumFractionDigits&&!0!==r.shouldNotRound)for(u+="";u.length<r.minimumFractionDigits;u+="0");return u.length&&(c+=e.decimalSeparator+u),"currency"===r.style&&(!0===e.isCurrencyFirst?c=e.currencySymbol+c:c+=" "+e.currencySymbol),c}function o(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.precision||r.precision;return{locale:t.locale||r.locale,precision:i}}(e,t);return null==r||"object"!=typeof r?r:((t=t||{}).maximumFractionDigits=r.precision,i(r.locale,e,t))}function u(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=null===(t=t||{}).power||void 0===t.power?0:t.power,i=t.unit;if(!i)return e;var o=e,u=0,l=null;if(e>=1){var a=(e+"").split(".")[0],c=a.length;u=3*Math.trunc(c/3),null!==t.maxPower&&void 0!==t.maxPower&&u+r>t.maxPower&&(l=t.maxPower-r),o=e*Math.pow(10,-(null!==l?l:u))}o<1&&(o*=Math.pow(10,3),-0===(r-=3)&&(r=0));var s=n(t.locale).unitPrefixes[(null!==l?l:u)+r];void 0===s?s="10^"+(u+r)+i:"string"!=typeof s?s=s[i]||s.default:s+=i;return{value:o,unit:s}}(e,t);return null==r||"object"!=typeof r?r:(t=t||{},(e=o(r.value,t))+" "+r.unit)}function l(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.precision||r.precision,o=t.currency||t.source||r.currency,u=t.locale||r.locale;t.target&&t.rates&&t.rates[t.target]&&(t.source=o,o=t.target,e=a(e,t));return{locale:u,currency:o,precision:i,value:e,shouldNotRound:t.shouldNotRound}}(e,t);return null==r||"object"!=typeof r?r:(r.precision<2&&(r.precision=2),r.style="currency",r.minimumFractionDigits=r.precision,i(r.locale,r.value,r))}function a(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.source||r.currency,o=t.target,u=t.rates;return!o||!u||u&&!u[i]||u&&!u[o]?e:e/u[i]*u[o]}const c={};return c.setOptions=r,c.setOption=function(e,r){null!=e&&(t.default[e]=r)},c.locale=function(e){e&&(t[e.locale]=e,r(t[e.locale]))},c.lowerCase=e,c.upperCase=function(e){return null==e||"string"!=typeof e?e:e.toUpperCase()},c.upperCaseFirstChar=function(t){return null!=t&&"string"==typeof t&&t.length?t[0].toUpperCase()+e(t.slice(1,t.length)):t},c.formatN=o,c.formatNumber=o,c.percent=function(e,t){let r=function(e){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=100*e;return e>1&&(t=e),{value:t}}(e);return null==r||"object"!=typeof r?r:o(r.value,t)+"%"},c.averageN=u,c.averageNumber=u,c.formatC=l,c.formatCurrency=l,c.convC=a,c.convertCurrency=a,c});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).kittenFormat=t()}(this,function(){"use strict";function e(e){return null==e||"string"!=typeof e?e:e.toLowerCase()}var t={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 r(e){e&&(t.default=e)}function n(e){return t[e]?t[e]:t.default}function i(e,t,r){e=n(e);let i=(t+="").split("."),o=i[0],u=i[1]||"",l=e.thousandSeparator||" ",a=0,c="";for(let e=o.length-1;e>=0;e--)c=o[e]+c,3===++a&&e-1>=0&&(c=l+c,a=0);if("currency"===r.style&&!0!==r.shouldNotRound&&(r.maximumFractionDigits=r.minimumFractionDigits,null==r.minimumFractionDigits&&(r.minimumFractionDigits=e.precision)),"0"!==u[u.length-1]&&!0!==r.shouldNotRound&&(u=(function(e,t){var r=Math.pow(10,t);return Math.round(e*r)/r}(Number("0."+u,10),r.maximumFractionDigits?r.maximumFractionDigits:e.precision)+"").slice(2)),null!=r.minimumFractionDigits&&!0!==r.shouldNotRound)for(u+="";u.length<r.minimumFractionDigits;u+="0");return!0===r.shouldNotRound&&(u=u.slice(0,r.maximumFractionDigits?r.maximumFractionDigits:u.length)),u.length&&(c+=e.decimalSeparator+u),"currency"===r.style&&(!0===e.isCurrencyFirst?c=e.currencySymbol+c:c+=" "+e.currencySymbol),c}function o(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.precision;return{locale:t.locale||r.locale,precision:i}}(e,t);return null==r||"object"!=typeof r?r:((t=t||{}).maximumFractionDigits=r.precision,i(r.locale,e,t))}function u(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=null===(t=t||{}).power||void 0===t.power?0:t.power,i=t.unit;if(!i)return e;var o=e,u=0,l=null;if(e>=1){var a=(e+"").split(".")[0],c=a.length;u=3*Math.trunc(c/3),null!==t.maxPower&&void 0!==t.maxPower&&u+r>t.maxPower&&(l=t.maxPower-r),o=e*Math.pow(10,-(null!==l?l:u))}o<1&&(o*=Math.pow(10,3),-0===(r-=3)&&(r=0));var s=n(t.locale).unitPrefixes[(null!==l?l:u)+r];void 0===s?s="10^"+(u+r)+i:"string"!=typeof s?s=s[i]||s.default:s+=i;return{value:o,unit:s}}(e,t);return null==r||"object"!=typeof r?r:(t=t||{},(e=o(r.value,t))+" "+r.unit)}function l(e,t){let r=function(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.precision,o=t.currency||t.source||r.currency,u=t.locale||r.locale;t.target&&t.rates&&t.rates[t.target]&&(t.source=o,o=t.target,e=a(e,t));return{locale:u,currency:o,precision:i,value:e,shouldNotRound:t.shouldNotRound}}(e,t);return null==r||"object"!=typeof r?r:(r.precision<2&&(r.precision=2),r.style="currency",r.minimumFractionDigits=r.precision,i(r.locale,r.value,r))}function a(e,t){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var r=n((t=t||{}).locale),i=t.source||r.currency,o=t.target,u=t.rates;return!o||!u||u&&!u[i]||u&&!u[o]?e:e/u[i]*u[o]}const c={};return c.setOptions=r,c.setOption=function(e,r){null!=e&&(t.default[e]=r)},c.locale=function(e){e&&(t[e.locale]=e,r(t[e.locale]))},c.lowerCase=e,c.upperCase=function(e){return null==e||"string"!=typeof e?e:e.toUpperCase()},c.upperCaseFirstChar=function(t){return null!=t&&"string"==typeof t&&t.length?t[0].toUpperCase()+e(t.slice(1,t.length)):t},c.formatN=o,c.formatNumber=o,c.percent=function(e,t){let r=function(e){if(null==e)return e;if("string"==typeof e&&isNaN(e))return"-";var t=100*e;return e>1&&(t=e),{value:t}}(e);return null==r||"object"!=typeof r?r:o(r.value,t)+"%"},c.averageN=u,c.averageNumber=u,c.formatC=l,c.formatCurrency=l,c.convC=a,c.convertCurrency=a,c});

@@ -159,3 +159,3 @@ 'use strict';

if (options.style === 'currency') {
if (options.style === 'currency' && options.shouldNotRound !== true) {
options.maximumFractionDigits = options.minimumFractionDigits;

@@ -175,2 +175,6 @@ if (options.minimumFractionDigits == null) {

if (options.shouldNotRound === true) {
fraction = fraction.slice(0, options.maximumFractionDigits ? options.maximumFractionDigits : fraction.length);
}
if (fraction.length) {

@@ -264,3 +268,3 @@ res += locale$$1.decimalSeparator + fraction;

var _localeOptions = getLocale(options.locale);
var _precision = options.precision || _localeOptions.precision;
var _precision = options.precision;
var _locale = options.locale || _localeOptions.locale;

@@ -409,3 +413,3 @@

var _localeOptions = getLocale(options.locale);
var _precision = options.precision || _localeOptions.precision;
var _precision = options.precision;
var _currency = options.currency || options.source || _localeOptions.currency;

@@ -412,0 +416,0 @@ var _locale = options.locale || _localeOptions.locale;

{
"name": "kitten-format",
"version": "1.8.2",
"version": "1.8.3",
"description": "Fast formatters for browsers",

@@ -5,0 +5,0 @@ "main": "kittenFormat.server.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc