Socket
Socket
Sign inDemoInstall

vega-format

Package Overview
Dependencies
7
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.2 to 1.0.3

9

build/vega-format.js

@@ -14,10 +14,9 @@ (function (global, factory) {

return x => {
let str = numberFormat(x),
dec = str.indexOf(decimalChar),
idx, end;
const str = numberFormat(x),
dec = str.indexOf(decimalChar);
if (dec < 0) return str;
idx = rightmostDigit(str, dec);
end = idx < str.length ? str.slice(idx) : '';
let idx = rightmostDigit(str, dec);
const end = idx < str.length ? str.slice(idx) : '';
while (--idx > dec) if (str[idx] !== '0') { ++idx; break; }

@@ -24,0 +23,0 @@

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

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-format"),require("vega-time"),require("vega-util"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-format","vega-time","vega-util","d3-time-format"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.d3,e.d3,e.vega,e.vega,e.d3)}(this,(function(e,t,r,a,i,o){"use strict";function n(e){const t={};return r=>t[r]||(t[r]=e(r))}function c(e){const a=n(e.format),i=e.formatPrefix;return{format:a,formatPrefix:i,formatFloat(e){const t=r.formatSpecifier(e||",");if(null==t.precision){switch(t.precision=12,t.type){case"%":t.precision-=2;break;case"e":t.precision-=1}return i=a(t),o=a(".1f")(1)[1],e=>{let t,r,a=i(e),n=a.indexOf(o);if(n<0)return a;for(t=function(e,t){let r,a=e.lastIndexOf("e");if(a>0)return a;for(a=e.length;--a>t;)if(r=e.charCodeAt(a),r>=48&&r<=57)return a+1}(a,n),r=t<a.length?a.slice(t):"";--t>n;)if("0"!==a[t]){++t;break}return a.slice(0,t)+r}}return a(t);var i,o},formatSpan(e,o,n,c){c=r.formatSpecifier(null==c?",f":c);const f=t.tickStep(e,o,n),u=Math.max(Math.abs(e),Math.abs(o));let s;if(null==c.precision)switch(c.type){case"s":return isNaN(s=r.precisionPrefix(f,u))||(c.precision=s),i(c,u);case"":case"e":case"g":case"p":case"r":isNaN(s=r.precisionRound(f,u))||(c.precision=s-("e"===c.type));break;case"f":case"%":isNaN(s=r.precisionFixed(f))||(c.precision=s-2*("%"===c.type))}return a(c)}}}let f,u;function s(){return f=c({format:r.format,formatPrefix:r.formatPrefix})}function m(e){return c(r.formatLocale(e))}function l(e){return arguments.length?f=m(e):f}function p(e,t,r){r=r||{},i.isObject(r)||i.error("Invalid time multi-format specifier: "+r);const o=t(a.SECONDS),n=t(a.MINUTES),c=t(a.HOURS),f=t(a.DATE),u=t(a.WEEK),s=t(a.MONTH),m=t(a.QUARTER),l=t(a.YEAR),p=e(r[a.MILLISECONDS]||".%L"),d=e(r[a.SECONDS]||":%S"),g=e(r[a.MINUTES]||"%I:%M"),S=e(r[a.HOURS]||"%I %p"),h=e(r[a.DATE]||r[a.DAY]||"%a %d"),E=e(r[a.WEEK]||"%b %d"),F=e(r[a.MONTH]||"%B"),b=e(r[a.QUARTER]||"%B"),x=e(r[a.YEAR]||"%Y");return e=>(o(e)<e?p:n(e)<e?d:c(e)<e?g:f(e)<e?S:s(e)<e?u(e)<e?h:E:l(e)<e?m(e)<e?F:b:x)(e)}function d(e){const t=n(e.format),r=n(e.utcFormat);return{timeFormat:e=>i.isString(e)?t(e):p(t,a.timeInterval,e),utcFormat:e=>i.isString(e)?r(e):p(r,a.utcInterval,e),timeParse:n(e.parse),utcParse:n(e.utcParse)}}function g(){return u=d({format:o.timeFormat,parse:o.timeParse,utcFormat:o.utcFormat,utcParse:o.utcParse})}function S(e){return d(o.timeFormatLocale(e))}function h(e){return arguments.length?u=S(e):u}s(),g();const E=(e,t)=>i.extend({},e,t);function F(e,t){const r=arguments.length;return r&&2!==r&&i.error("defaultLocale expects either zero or two arguments."),r?E(l(e),h(t)):E(l(),h())}e.defaultLocale=F,e.locale=function(e,t){const r=e?m(e):l(),a=t?S(t):h();return E(r,a)},e.numberFormatDefaultLocale=l,e.numberFormatLocale=m,e.resetDefaultLocale=function(){return s(),g(),F()},e.resetNumberFormatDefaultLocale=s,e.resetTimeFormatDefaultLocale=g,e.timeFormatDefaultLocale=h,e.timeFormatLocale=S,Object.defineProperty(e,"__esModule",{value:!0})}));
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("d3-array"),require("d3-format"),require("vega-time"),require("vega-util"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","d3-array","d3-format","vega-time","vega-util","d3-time-format"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vega={},e.d3,e.d3,e.vega,e.vega,e.d3)}(this,(function(e,t,r,a,o,n){"use strict";function i(e){const t={};return r=>t[r]||(t[r]=e(r))}function c(e){const a=i(e.format),o=e.formatPrefix;return{format:a,formatPrefix:o,formatFloat(e){const t=r.formatSpecifier(e||",");if(null==t.precision){switch(t.precision=12,t.type){case"%":t.precision-=2;break;case"e":t.precision-=1}return o=a(t),n=a(".1f")(1)[1],e=>{const t=o(e),r=t.indexOf(n);if(r<0)return t;let a=function(e,t){let r,a=e.lastIndexOf("e");if(a>0)return a;for(a=e.length;--a>t;)if(r=e.charCodeAt(a),r>=48&&r<=57)return a+1}(t,r);const i=a<t.length?t.slice(a):"";for(;--a>r;)if("0"!==t[a]){++a;break}return t.slice(0,a)+i}}return a(t);var o,n},formatSpan(e,n,i,c){c=r.formatSpecifier(null==c?",f":c);const f=t.tickStep(e,n,i),u=Math.max(Math.abs(e),Math.abs(n));let s;if(null==c.precision)switch(c.type){case"s":return isNaN(s=r.precisionPrefix(f,u))||(c.precision=s),o(c,u);case"":case"e":case"g":case"p":case"r":isNaN(s=r.precisionRound(f,u))||(c.precision=s-("e"===c.type));break;case"f":case"%":isNaN(s=r.precisionFixed(f))||(c.precision=s-2*("%"===c.type))}return a(c)}}}let f,u;function s(){return f=c({format:r.format,formatPrefix:r.formatPrefix})}function m(e){return c(r.formatLocale(e))}function l(e){return arguments.length?f=m(e):f}function p(e,t,r){r=r||{},o.isObject(r)||o.error("Invalid time multi-format specifier: "+r);const n=t(a.SECONDS),i=t(a.MINUTES),c=t(a.HOURS),f=t(a.DATE),u=t(a.WEEK),s=t(a.MONTH),m=t(a.QUARTER),l=t(a.YEAR),p=e(r[a.MILLISECONDS]||".%L"),d=e(r[a.SECONDS]||":%S"),g=e(r[a.MINUTES]||"%I:%M"),S=e(r[a.HOURS]||"%I %p"),h=e(r[a.DATE]||r[a.DAY]||"%a %d"),E=e(r[a.WEEK]||"%b %d"),F=e(r[a.MONTH]||"%B"),b=e(r[a.QUARTER]||"%B"),x=e(r[a.YEAR]||"%Y");return e=>(n(e)<e?p:i(e)<e?d:c(e)<e?g:f(e)<e?S:s(e)<e?u(e)<e?h:E:l(e)<e?m(e)<e?F:b:x)(e)}function d(e){const t=i(e.format),r=i(e.utcFormat);return{timeFormat:e=>o.isString(e)?t(e):p(t,a.timeInterval,e),utcFormat:e=>o.isString(e)?r(e):p(r,a.utcInterval,e),timeParse:i(e.parse),utcParse:i(e.utcParse)}}function g(){return u=d({format:n.timeFormat,parse:n.timeParse,utcFormat:n.utcFormat,utcParse:n.utcParse})}function S(e){return d(n.timeFormatLocale(e))}function h(e){return arguments.length?u=S(e):u}s(),g();const E=(e,t)=>o.extend({},e,t);function F(e,t){const r=arguments.length;return r&&2!==r&&o.error("defaultLocale expects either zero or two arguments."),r?E(l(e),h(t)):E(l(),h())}e.defaultLocale=F,e.locale=function(e,t){const r=e?m(e):l(),a=t?S(t):h();return E(r,a)},e.numberFormatDefaultLocale=l,e.numberFormatLocale=m,e.resetDefaultLocale=function(){return s(),g(),F()},e.resetNumberFormatDefaultLocale=s,e.resetTimeFormatDefaultLocale=g,e.timeFormatDefaultLocale=h,e.timeFormatLocale=S,Object.defineProperty(e,"__esModule",{value:!0})}));
{
"name": "vega-format",
"version": "1.0.2",
"version": "1.0.3",
"description": "JavaScript string formatting utilities for Vega.",

@@ -28,9 +28,9 @@ "keywords": [

"dependencies": {
"d3-array": "^2.5.1",
"d3-format": "^1.4.4",
"d3-time-format": "^2.2.3",
"vega-time": "^2.0.2",
"vega-util": "^1.15.0"
"d3-array": "^2.7.0",
"d3-format": "^2.0.0",
"d3-time-format": "^3.0.0",
"vega-time": "^2.0.3",
"vega-util": "^1.15.1"
},
"gitHead": "28db83352e43e321dfe55fc5cb6489b211e45662"
"gitHead": "8d6793f4ca7eaaf2d22186764e9ce2dae687cf52"
}

@@ -15,10 +15,9 @@ import memoize from './memoize';

return x => {
let str = numberFormat(x),
dec = str.indexOf(decimalChar),
idx, end;
const str = numberFormat(x),
dec = str.indexOf(decimalChar);
if (dec < 0) return str;
idx = rightmostDigit(str, dec);
end = idx < str.length ? str.slice(idx) : '';
let idx = rightmostDigit(str, dec);
const end = idx < str.length ? str.slice(idx) : '';
while (--idx > dec) if (str[idx] !== '0') { ++idx; break; }

@@ -25,0 +24,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc