Socket
Socket
Sign inDemoInstall

d3-format

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-format - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

src/locale/ja-JP.js

8

build/format.js

@@ -68,2 +68,9 @@ if (typeof Map === "undefined") {

var jaJp = {
decimal: ",",
thousands: ",",
grouping: [3],
currency: ["", "円"]
};
var itIt = {

@@ -434,2 +441,3 @@ decimal: ",",

.set("it-IT", itIt)
.set("ja-JP", jaJp)
.set("mk-MK", mkMk)

@@ -436,0 +444,0 @@ .set("nl-NL", nlNl)

2

build/format.min.js

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

"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(t,n){return this._[t]=n,this},get:function(t){return this._[t]},has:function(t){return t in this._},"delete":function(t){return t in this._&&delete this._[t]},clear:function(){this._=Object.create(null)},get size(){var t=0;for(var n in this._)++t;return t},forEach:function(t){for(var n in this._)t(this._[n],n,this)}}):function(){var t=new Map;t.set(0,0)!==t&&(t=t.set,Map.prototype.set=function(){return t.apply(this,arguments),this})}(),function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.format={})}(this,function(t){"use strict";function n(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function r(t){return t=n(Math.abs(t)),t?t[1]:NaN}function e(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1],u=o-(p=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=i.length;return u===a?i:u>a?i+new Array(u-a+1).join("0"):u>0?i.slice(0,u)+"."+i.slice(u):"0."+new Array(1-u).join("0")+n(t,r+u-1)[0]}function i(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1];return 0>o?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}function o(t,n){t=t.toPrecision(n);t:for(var r,e=t.length,i=1,o=-1;e>i;++i)switch(t[i]){case".":o=r=i;break;case"0":0===o&&(o=i),r=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(r+1):t}function u(t){return new a(t)}function a(t){if(!(n=R.exec(t)))throw new Error("invalid format: "+t);var n,r=n[1]||" ",e=n[2]||">",i=n[3]||"-",o=n[4]||"",u=!!n[5],a=n[6]&&+n[6],s=!!n[7],c=n[8]&&+n[8].slice(1),h=n[9]||"";"n"===h?(s=!0,h="g"):F[h]||(h=""),(u||"0"===r&&"="===e)&&(u=!0,r="0",e="="),this.fill=r,this.align=e,this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=s,this.precision=c,this.type=h}function s(t,n){return function(r,e){for(var i=r.length,o=[],u=0,a=t[0],s=0;i>0&&a>0&&(s+a+1>e&&(a=Math.max(1,e-s)),o.push(r.substring(i-=a,i+a)),!((s+=a+1)>e));)a=t[u=(u+1)%t.length];return o.reverse().join(n)}}function c(t){return t}function h(t){function n(t){t=u(t);var n=t.fill,r=t.align,e=t.sign,s=t.symbol,c=t.zero,h=t.width,f=t.comma,l=t.precision,g=t.type,d="$"===s?o[0]:"#"===s&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",m="$"===s?o[1]:/[%p]/.test(g)?"%":"",y=F[g],M=!g||/[defgprs%]/.test(g);return l=null==l?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,l)):Math.max(0,Math.min(20,l)),function(t){var o=d,u=m;if("c"===g)u=y(t)+u,t="";else{t=+t;var s=(0>t||0>1/t)&&(t*=-1,!0);if(t=y(t,l),o=(s?"("===e?e:"-":"-"===e||"("===e?"":e)+o,u=u+("s"===g?L[8+p/3]:"")+(s&&"("===e?")":""),M)for(var x,v=-1,b=t.length;++v<b;)if(x=t.charCodeAt(v),48>x||x>57){u=(46===x?a+t.slice(v+1):t.slice(v))+u,t=t.slice(0,v);break}}f&&!c&&(t=i(t,1/0));var w=o.length+t.length+u.length,j=h>w?new Array(h-w+1).join(n):"";switch(f&&c&&(t=i(j+t,j.length?h-u.length:1/0),j=""),r){case"<":return o+t+u+j;case"=":return o+j+t+u;case"^":return j.slice(0,w=j.length>>1)+o+t+u+j.slice(w)}return j+o+t+u}}function e(t,e){var i=n((t=u(t),t.type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(r(e)/3))),a=Math.pow(10,-o),s=L[8+o/3];return function(t){return i(a*t)+s}}var i=t.grouping&&t.thousands?s(t.grouping,t.thousands):c,o=t.currency,a=t.decimal;return{format:n,formatPrefix:e}}function f(t,n){return Math.max(0,r(Math.abs(n))-r(Math.abs(t)))+1}function l(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(r(n)/3)))-r(Math.abs(t)))}function g(t){return Math.max(0,-r(Math.abs(t)))}function d(t){return"string"!=typeof t||(t=N.get(t))?h(t):null}var p,m={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},y={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},M={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},x={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},v={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},b={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},w={decimal:",",thousands:".",grouping:[3],currency:["€",""]},j={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},S={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},E={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},_={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},A={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},P={decimal:".",thousands:",",grouping:[3],currency:["$",""]},$={decimal:".",thousands:",",grouping:[3],currency:["£",""]},z={decimal:".",thousands:",",grouping:[3],currency:["$",""]},k={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},C={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},F={"":o,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return i(100*t,n)},r:i,s:e,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},R=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var L=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],N=(new Map).set("ca-ES",C).set("de-DE",k).set("en-CA",z).set("en-GB",$).set("en-US",P).set("es-ES",A).set("fi-FI",_).set("fr-CA",E).set("fr-FR",S).set("he-IL",j).set("it-IT",w).set("mk-MK",b).set("nl-NL",v).set("pl-PL",x).set("pt-BR",M).set("ru-RU",y).set("zh-CN",m),I=h(P);t.format=I.format,t.formatPrefix=I.formatPrefix,t.localeFormat=d,t.formatSpecifier=u,t.precisionFixed=g,t.precisionPrefix=l,t.precisionRound=f});
"undefined"==typeof Map?(Map=function(){this.clear()},Map.prototype={set:function(t,n){return this._[t]=n,this},get:function(t){return this._[t]},has:function(t){return t in this._},"delete":function(t){return t in this._&&delete this._[t]},clear:function(){this._=Object.create(null)},get size(){var t=0;for(var n in this._)++t;return t},forEach:function(t){for(var n in this._)t(this._[n],n,this)}}):function(){var t=new Map;t.set(0,0)!==t&&(t=t.set,Map.prototype.set=function(){return t.apply(this,arguments),this})}(),function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.format={})}(this,function(t){"use strict";function n(t,n){if((r=(t=n?t.toExponential(n-1):t.toExponential()).indexOf("e"))<0)return null;var r,e=t.slice(0,r);return[e.length>1?e[0]+e.slice(2):e,+t.slice(r+1)]}function r(t){return t=n(Math.abs(t)),t?t[1]:NaN}function e(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1],u=o-(p=3*Math.max(-8,Math.min(8,Math.floor(o/3))))+1,a=i.length;return u===a?i:u>a?i+new Array(u-a+1).join("0"):u>0?i.slice(0,u)+"."+i.slice(u):"0."+new Array(1-u).join("0")+n(t,r+u-1)[0]}function i(t,r){var e=n(t,r);if(!e)return t+"";var i=e[0],o=e[1];return 0>o?"0."+new Array(-o).join("0")+i:i.length>o+1?i.slice(0,o+1)+"."+i.slice(o+1):i+new Array(o-i.length+2).join("0")}function o(t,n){t=t.toPrecision(n);t:for(var r,e=t.length,i=1,o=-1;e>i;++i)switch(t[i]){case".":o=r=i;break;case"0":0===o&&(o=i),r=i;break;case"e":break t;default:o>0&&(o=0)}return o>0?t.slice(0,o)+t.slice(r+1):t}function u(t){return new a(t)}function a(t){if(!(n=L.exec(t)))throw new Error("invalid format: "+t);var n,r=n[1]||" ",e=n[2]||">",i=n[3]||"-",o=n[4]||"",u=!!n[5],a=n[6]&&+n[6],s=!!n[7],c=n[8]&&+n[8].slice(1),h=n[9]||"";"n"===h?(s=!0,h="g"):R[h]||(h=""),(u||"0"===r&&"="===e)&&(u=!0,r="0",e="="),this.fill=r,this.align=e,this.sign=i,this.symbol=o,this.zero=u,this.width=a,this.comma=s,this.precision=c,this.type=h}function s(t,n){return function(r,e){for(var i=r.length,o=[],u=0,a=t[0],s=0;i>0&&a>0&&(s+a+1>e&&(a=Math.max(1,e-s)),o.push(r.substring(i-=a,i+a)),!((s+=a+1)>e));)a=t[u=(u+1)%t.length];return o.reverse().join(n)}}function c(t){return t}function h(t){function n(t){t=u(t);var n=t.fill,r=t.align,e=t.sign,s=t.symbol,c=t.zero,h=t.width,f=t.comma,l=t.precision,g=t.type,d="$"===s?o[0]:"#"===s&&/[boxX]/.test(g)?"0"+g.toLowerCase():"",m="$"===s?o[1]:/[%p]/.test(g)?"%":"",y=R[g],M=!g||/[defgprs%]/.test(g);return l=null==l?g?6:12:/[gprs]/.test(g)?Math.max(1,Math.min(21,l)):Math.max(0,Math.min(20,l)),function(t){var o=d,u=m;if("c"===g)u=y(t)+u,t="";else{t=+t;var s=(0>t||0>1/t)&&(t*=-1,!0);if(t=y(t,l),o=(s?"("===e?e:"-":"-"===e||"("===e?"":e)+o,u=u+("s"===g?N[8+p/3]:"")+(s&&"("===e?")":""),M)for(var x,v=-1,b=t.length;++v<b;)if(x=t.charCodeAt(v),48>x||x>57){u=(46===x?a+t.slice(v+1):t.slice(v))+u,t=t.slice(0,v);break}}f&&!c&&(t=i(t,1/0));var w=o.length+t.length+u.length,j=h>w?new Array(h-w+1).join(n):"";switch(f&&c&&(t=i(j+t,j.length?h-u.length:1/0),j=""),r){case"<":return o+t+u+j;case"=":return o+j+t+u;case"^":return j.slice(0,w=j.length>>1)+o+t+u+j.slice(w)}return j+o+t+u}}function e(t,e){var i=n((t=u(t),t.type="f",t)),o=3*Math.max(-8,Math.min(8,Math.floor(r(e)/3))),a=Math.pow(10,-o),s=N[8+o/3];return function(t){return i(a*t)+s}}var i=t.grouping&&t.thousands?s(t.grouping,t.thousands):c,o=t.currency,a=t.decimal;return{format:n,formatPrefix:e}}function f(t,n){return Math.max(0,r(Math.abs(n))-r(Math.abs(t)))+1}function l(t,n){return Math.max(0,3*Math.max(-8,Math.min(8,Math.floor(r(n)/3)))-r(Math.abs(t)))}function g(t){return Math.max(0,-r(Math.abs(t)))}function d(t){return"string"!=typeof t||(t=I.get(t))?h(t):null}var p,m={decimal:".",thousands:",",grouping:[3],currency:["¥",""]},y={decimal:",",thousands:" ",grouping:[3],currency:[""," руб."]},M={decimal:",",thousands:".",grouping:[3],currency:["R$",""]},x={decimal:",",thousands:".",grouping:[3],currency:["","zł"]},v={decimal:",",thousands:".",grouping:[3],currency:["€ ",""]},b={decimal:",",thousands:".",grouping:[3],currency:[""," ден."]},w={decimal:",",thousands:",",grouping:[3],currency:["","円"]},j={decimal:",",thousands:".",grouping:[3],currency:["€",""]},S={decimal:".",thousands:",",grouping:[3],currency:["₪",""]},E={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},P={decimal:",",thousands:" ",grouping:[3],currency:["","$"]},_={decimal:",",thousands:" ",grouping:[3],currency:[""," €"]},A={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},$={decimal:".",thousands:",",grouping:[3],currency:["$",""]},z={decimal:".",thousands:",",grouping:[3],currency:["£",""]},k={decimal:".",thousands:",",grouping:[3],currency:["$",""]},C={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},F={decimal:",",thousands:".",grouping:[3],currency:[""," €"]},R={"":o,"%":function(t,n){return(100*t).toFixed(n)},b:function(t){return Math.round(t).toString(2)},c:function(t){return t+""},d:function(t){return Math.round(t).toString(10)},e:function(t,n){return t.toExponential(n)},f:function(t,n){return t.toFixed(n)},g:function(t,n){return t.toPrecision(n)},o:function(t){return Math.round(t).toString(8)},p:function(t,n){return i(100*t,n)},r:i,s:e,X:function(t){return Math.round(t).toString(16).toUpperCase()},x:function(t){return Math.round(t).toString(16)}},L=/^(?:(.)?([<>=^]))?([+\-\( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?([a-z%])?$/i;a.prototype.toString=function(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(null==this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(null==this.precision?"":"."+Math.max(0,0|this.precision))+this.type};var N=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"],I=(new Map).set("ca-ES",F).set("de-DE",C).set("en-CA",k).set("en-GB",z).set("en-US",$).set("es-ES",A).set("fi-FI",_).set("fr-CA",P).set("fr-FR",E).set("he-IL",S).set("it-IT",j).set("ja-JP",w).set("mk-MK",b).set("nl-NL",v).set("pl-PL",x).set("pt-BR",M).set("ru-RU",y).set("zh-CN",m),O=h($);t.format=O.format,t.formatPrefix=O.formatPrefix,t.localeFormat=d,t.formatSpecifier=u,t.precisionFixed=g,t.precisionPrefix=l,t.precisionRound=f});

@@ -18,2 +18,3 @@ import formatSpecifier from "./src/formatSpecifier";

import itIt from "./src/locale/it-IT";
import jaJp from "./src/locale/ja-JP";
import mkMk from "./src/locale/mk-MK";

@@ -38,2 +39,3 @@ import nlNl from "./src/locale/nl-NL";

.set("it-IT", itIt)
.set("ja-JP", jaJp)
.set("mk-MK", mkMk)

@@ -40,0 +42,0 @@ .set("nl-NL", nlNl)

{
"name": "d3-format",
"version": "0.3.0",
"version": "0.3.1",
"description": "Format numbers for human consumption.",

@@ -5,0 +5,0 @@ "keywords": [

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