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.4.4 to 1.5.0

10

kittenFormat.client.js

@@ -167,2 +167,3 @@ (function (global, factory) {

var _averagePower = 0;
var _displayPower = null;

@@ -173,3 +174,8 @@ if (value >= 1) {

_averagePower = Math.trunc(_valueLength / 3) * 3;
_value = value * Math.pow(10, -_averagePower);
if ((options.maxPower !== null && options.maxPower !== undefined) && _averagePower + _power > options.maxPower) {
_displayPower = options.maxPower - _power;
}
_value = value * Math.pow(10, -(_displayPower !== null ?_displayPower : _averagePower));
}

@@ -190,3 +196,3 @@

var _unitPrefix = _unitPrefixes[_averagePower + _power];
var _unitPrefix = _unitPrefixes[(_displayPower !== null ? _displayPower : _averagePower) + _power];

@@ -193,0 +199,0 @@ if (_unitPrefix === undefined) {

2

kittenFormat.client.min.js

@@ -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,i,o=n((e=e||{}).locale),l=e.precision||o.precision,f=e.locale||o.locale;return(a=f,u=l,i=a+":"+u,t[i]||(t[i]=new Intl.NumberFormat(a,{maximumFractionDigits:u})),t[i]).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 i=r,o=0;if(r>=1){var l=(r+"").split(".")[0].length;o=3*Math.trunc(l/3),i=r*Math.pow(10,-o)}i<1&&(i*=Math.pow(10,3),-0===(t-=3)&&(t=0));var f=n(e.locale).unitPrefixes,c=a(i,e),s=f[o+t];return void 0===s?s="10^"+(o+t)+u:"string"!=typeof s?s=s[u]||s.default:s+=u,c+" "+s}function i(r){return null==r||"string"!=typeof r?r:r.toLowerCase()}var o={};o.setOptions=e,o.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])}},o.averageN=u,o.averageNumber=u,o.lowerCase=i,o.upperCase=function(r){return null==r||"string"!=typeof r?r:r.toUpperCase()},o.upperCaseFirstChar=function(r){return null!=r&&"string"==typeof r&&r.length?r[0].toUpperCase()+i(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||t.currency;return function(r,e,n){n<2&&(n=2);var t=r+":"+e+":"+n;return l[t]||(l[t]=new Intl.NumberFormat(r,{maximumFractionDigits:n,currency:e,style:"currency"})),l[t]}(e.locale||t.locale,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,i=e.rates;return!u||!i||i&&!i[a]||i&&!i[u]?r:r/i[a]*i[u]}return o.formatC=f,o.formatCurrency=f,o.convC=c,o.convertCurrency=c,o.formatN=a,o.formatNumber=a,o.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)+"%"},o});
!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.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||t.currency;return function(r,e,n){n<2&&(n=2);var t=r+":"+e+":"+n;return l[t]||(l[t]=new Intl.NumberFormat(r,{maximumFractionDigits:n,currency:e,style:"currency"})),l[t]}(e.locale||t.locale,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});
{
"name": "kitten-format",
"version": "1.4.4",
"version": "1.5.0",
"description": "Fast formatters for browsers",

@@ -5,0 +5,0 @@ "main": "kittenFormat.client.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