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

vega-util

Package Overview
Dependencies
Maintainers
1
Versions
43
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-util - npm Package Compare versions

Comparing version 1.12.2 to 1.13.0

src/lruCache.js

54

build/vega-util.js

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

function hasOwnProperty(object, property) {
function has(object, property) {
return hop.call(object, property);

@@ -560,4 +560,4 @@ }

function has(key) {
return hasOwnProperty(obj, key) && obj[key] !== NULL;
function has$1(key) {
return has(obj, key) && obj[key] !== NULL;
}

@@ -569,8 +569,8 @@

object: obj,
has: has,
has: has$1,
get: function(key) {
return has(key) ? obj[key] : undefined;
return has$1(key) ? obj[key] : undefined;
},
set: function(key, value) {
if (!has(key)) {
if (!has$1(key)) {
++map.size;

@@ -583,3 +583,3 @@ if (obj[key] === NULL) --map.empty;

delete: function(key) {
if (has(key)) {
if (has$1(key)) {
--map.size;

@@ -716,2 +716,39 @@ ++map.empty;

const DEFAULT_MAX_SIZE = 10000;
// adapted from https://github.com/dominictarr/hashlru/ (MIT License)
function lruCache(maxsize) {
maxsize = +maxsize || DEFAULT_MAX_SIZE;
let curr, prev, size;
const clear = () => {
curr = {};
prev = {};
size = 0;
};
const update = (key, value) => {
if (++size > maxsize) {
prev = curr;
curr = {};
size = 1;
}
return (curr[key] = value);
};
clear();
return {
clear,
has: key => has(curr, key) || has(prev, key),
get: key => has(curr, key) ? curr[key]
: has(prev, key) ? update(key, prev[key])
: undefined,
set: (key, value) => has(curr, key)
? (curr[key] = value)
: update(key, value)
};
}
function merge(compare, array0, array1, output) {

@@ -837,3 +874,3 @@ var n0 = array0.length,

exports.flush = flush;
exports.hasOwnProperty = hasOwnProperty;
exports.hasOwnProperty = has;
exports.id = id;

@@ -854,2 +891,3 @@ exports.identity = identity;

exports.logger = logger;
exports.lruCache = lruCache;
exports.merge = merge;

@@ -856,0 +894,0 @@ exports.mergeConfig = mergeConfig;

2

build/vega-util.min.js

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

!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).vega={})}(this,(function(n){"use strict";function t(n,t,r){return n.fields=t||[],n.fname=r,n}function r(n){return null==n?null:n.fields}function e(n){throw Error(n)}function u(n){var t,r,u,o=[],i=null,c=0,f=n.length,l="";function a(){o.push(l+n.substring(t,r)),l="",t=r+1}for(n+="",t=r=0;r<f;++r)if("\\"===(u=n[r]))l+=n.substring(t,r),l+=n.substring(++r,++r),t=r;else if(u===i)a(),i=null,c=-1;else{if(i)continue;t===c&&'"'===u?(t=r+1,i=u):t===c&&"'"===u?(t=r+1,i=u):"."!==u||c?"["===u?(r>t&&a(),c=t=r+1):"]"===u&&(c||e("Access path missing open bracket: "+n),c>0&&a(),c=0,t=r+1):r>t?a():t=r+1}return c&&e("Access path missing closing bracket: "+n),i&&e("Access path missing closing quote: "+n),r>t&&(r++,a()),o}var o=Array.isArray;function i(n){return n===Object(n)}function c(n){return"string"==typeof n}function f(n){return o(n)?"["+n.map(f)+"]":i(n)||c(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function l(n,r){var e=u(n),o="return _["+e.map(f).join("][")+"];";return t(Function("_",o),[n=1===e.length?e[0]:n],r||n)}var a=[],s=l("id"),g=t((function(n){return n}),a,"identity"),h=t((function(){return 0}),a,"zero"),p=t((function(){return 1}),a,"one"),v=t((function(){return!0}),a,"true"),m=t((function(){return!1}),a,"false");function y(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}function b(n,t,r,e){var u,c;if(i(r)&&!o(r))for(u in c=i(n[t])?n[t]:n[t]={},r)e&&(!0===e||e[u])?b(c,u,r[u]):c[u]=r[u];else n[t]=r}function d(n,t){if(null==n)return t;const r={},e=[];function u(n){r[n.name]||(r[n.name]=1,e.push(n))}return t.forEach(u),n.forEach(u),e}function M(n){return n[n.length-1]}function j(n){return null==n||""===n?null:+n}function O(n){return function(t){return n*Math.exp(t)}}function w(n){return function(t){return Math.log(n*t)}}function x(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function z(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function E(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function D(n,t,r,e){var u=r(n[0]),o=r(M(n)),i=(o-u)*t;return[e(u-i),e(o-i)]}function k(n,t,r,e,u){var o=e(n[0]),i=e(M(n)),c=null!=t?e(t):(o+i)/2;return[u(c+(o-c)*r),u(c+(i-c)*r)]}function A(n){return null!=n?o(n)?n:[n]:[]}function S(n){return"function"==typeof n}const N=Object.prototype.hasOwnProperty;function R(n,t){return N.call(n,t)}var F={};function P(n){return"[object Date]"===Object.prototype.toString.call(n)}function _(n){return"number"==typeof n}function L(n,t){for(var r="";--t>=0;)r+=n;return r}function q(n){return _(n)?n:P(n)?n:Date.parse(n)}n.Debug=4,n.Error=1,n.Info=3,n.None=0,n.Warn=2,n.accessor=t,n.accessorFields=r,n.accessorName=function(n){return null==n?null:n.fname},n.array=A,n.clampRange=function(n,t,r){var e,u=n[0],o=n[1];return o<u&&(e=o,o=u,u=e),(e=o-u)>=r-t?[t,r]:[u=Math.min(Math.max(u,t),r-e),u+e]},n.compare=function(n,e){var o,i,c,l,a,s,g,h,p,v=[],m=(n=A(n)).map((function(n,t){return null==n?null:(v.push(t),S(n)?n:u(n).map(f).join("]["))})),y=v.length-1,b=A(e),d="var u,v;return ";if(y<0)return null;for(i=0;i<=y;++i)S(c=m[o=v[i]])?(l="(u=this."+(s="f"+o)+"(a))",a="(v=this."+s+"(b))",(g=g||{})[s]=c):(l="(u=a["+c+"])",a="(v=b["+c+"])"),s="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==b[o]?(p=1,h=-1):(p=-1,h=1),d+="("+l+"<"+a+"||u==null)&&v!=null?"+h+":(u>v||v==null)&&u!=null?"+p+":"+s+"!==u&&v===v?"+h+":v!==v&&u===u?"+p+(o<y?":":":0");return c=Function("a","b",d+";"),g&&(c=c.bind(g)),n=n.reduce((function(n,t){return S(t)?(r(t)||[]).forEach((function(t){n[t]=1})):null!=t&&(n[t+""]=1),n}),{}),t(c,Object.keys(n))},n.constant=function(n){return S(n)?n:function(){return n}},n.debounce=function(n,t){var r,e;function u(){t(e),r=e=null}return function(t){e=t,r&&clearTimeout(r),r=setTimeout(u,n)}},n.error=e,n.extend=function(n){for(var t,r,e=1,u=arguments.length;e<u;++e)for(r in t=arguments[e])n[r]=t[r];return n},n.extent=function(n,t){var r,e,u,o,i=0;if(n&&(r=n.length))if(null==t){for(e=n[i];i<r&&(null==e||e!=e);e=n[++i]);for(u=o=e;i<r;++i)null!=(e=n[i])&&(e<u&&(u=e),e>o&&(o=e))}else{for(e=t(n[i]);i<r&&(null==e||e!=e);e=t(n[++i]));for(u=o=e;i<r;++i)null!=(e=t(n[i]))&&(e<u&&(u=e),e>o&&(o=e))}return[u,o]},n.extentIndex=function(n,t){var r,e,u,o,i,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(e=n[c])&&e>=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++c<f;)null!=(e=n[c])&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}else{for(;++c<f;)if(null!=(e=t(n[c],c,n))&&e>=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++c<f;)null!=(e=t(n[c],c,n))&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}return[o,i]},n.falsy=m,n.fastmap=function(n){var t,r,e={};function u(n){return R(e,n)&&e[n]!==F}return t={size:0,empty:0,object:e,has:u,get:function(n){return u(n)?e[n]:void 0},set:function(n,r){return u(n)||(++t.size,e[n]===F&&--t.empty),e[n]=r,this},delete:function(n){return u(n)&&(--t.size,++t.empty,e[n]=F),this},clear:function(){t.size=t.empty=0,t.object=e={}},test:function(n){return arguments.length?(r=n,t):r},clean:function(){var n,u,o={},i=0;for(n in e)(u=e[n])===F||r&&r(u)||(o[n]=u,++i);t.size=i,t.empty=0,t.object=e=o}},n&&Object.keys(n).forEach((function(r){t.set(r,n[r])})),t},n.field=l,n.flush=function(n,t,r,e,u,o){if(!r&&0!==r)return o;var i,c,f=n[0],l=M(n),a=+r;return l<f&&(i=f,f=l,l=i),(i=Math.abs(t-f))<(c=Math.abs(l-t))&&i<=a?e:c<=a?u:o},n.hasOwnProperty=R,n.id=s,n.identity=g,n.inherits=function(n,t){var r=n.prototype=Object.create(t.prototype);return r.constructor=n,r},n.inrange=function(n,t,r,e){var u,o=t[0],i=t[t.length-1];return o>i&&(u=o,o=i,i=u),e=void 0===e||e,((r=void 0===r||r)?o<=n:o<n)&&(e?n<=i:n<i)},n.isArray=o,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=P,n.isFunction=S,n.isNumber=_,n.isObject=i,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=c,n.key=function(n,r){return n&&(n=r?A(n).map((function(n){return n.replace(/\\(.)/g,"$1")})):A(n)),t(n&&n.length?Function("_","return ''+"+n.map((function(n){return"_["+(r?f(n):u(n).map(f).join("]["))+"]"})).join("+'|'+")+";"):function(){return""},n,"key")},n.lerp=function(n,t){const r=n[0],e=M(n),u=+t;return u?1===u?e:r+u*(e-r):r},n.logger=function(n,t){var r=n||0;return{level:function(n){return arguments.length?(r=+n,this):r},error:function(){return r>=1&&y(t||"error","ERROR",arguments),this},warn:function(){return r>=2&&y(t||"warn","WARN",arguments),this},info:function(){return r>=3&&y(t||"log","INFO",arguments),this},debug:function(){return r>=4&&y(t||"log","DEBUG",arguments),this}}},n.merge=function(n,t,r,e){var u=t.length,o=r.length;if(!o)return t;if(!u)return r;for(var i=e||new t.constructor(u+o),c=0,f=0,l=0;c<u&&f<o;++l)i[l]=n(t[c],r[f])>0?r[f++]:t[c++];for(;c<u;++c,++l)i[l]=t[c];for(;f<o;++f,++l)i[l]=r[f];return i},n.mergeConfig=function(...n){return n.reduce((n,t)=>{for(var r in t)if("signals"===r)n.signals=d(n.signals,t.signals);else{var e="legend"===r?{layout:1}:"style"===r||null;b(n,r,t[r],e)}return n},{})},n.one=p,n.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?L(u,i)+o:"center"===e?L(u,~~(i/2))+o+L(u,Math.ceil(i/2)):o+L(u,i)},n.panLinear=function(n,t){return D(n,t,j,g)},n.panLog=function(n,t){var r=Math.sign(n[0]);return D(n,t,w(r),O(r))},n.panPow=function(n,t,r){return D(n,t,E(r),E(1/r))},n.panSymlog=function(n,t,r){return D(n,t,x(r),z(r))},n.peek=M,n.quarter=function(n){return 1+~~(new Date(n).getMonth()/3)},n.repeat=L,n.span=function(n){return n&&M(n)-n[0]||0},n.splitAccessPath=u,n.stringValue=f,n.toBoolean=function(n){return null==n||""===n?null:!(!n||"false"===n||"0"===n)&&!!n},n.toDate=function(n,t){return t=t||q,null==n||""===n?null:t(n)},n.toNumber=j,n.toSet=function(n){for(var t={},r=0,e=n.length;r<e;++r)t[n[r]]=!0;return t},n.toString=function(n){return null==n||""===n?null:n+""},n.truncate=function(n,t,r,e){var u=null!=e?e:"…",o=n+"",i=o.length,c=Math.max(0,t-u.length);return i<=t?o:"left"===r?u+o.slice(i-c):"center"===r?o.slice(0,Math.ceil(c/2))+u+o.slice(i-~~(c/2)):o.slice(0,c)+u},n.truthy=v,n.utcquarter=function(n){return 1+~~(new Date(n).getUTCMonth()/3)},n.visitArray=function(n,t,r){if(n){var e,u=0,o=n.length;if(t)for(;u<o;++u)(e=t(n[u]))&&r(e,u,n);else n.forEach(r)}},n.writeConfig=b,n.zero=h,n.zoomLinear=function(n,t,r){return k(n,t,r,j,g)},n.zoomLog=function(n,t,r){var e=Math.sign(n[0]);return k(n,t,r,w(e),O(e))},n.zoomPow=function(n,t,r,e){return k(n,t,r,E(e),E(1/e))},n.zoomSymlog=function(n,t,r,e){return k(n,t,r,x(e),z(e))},Object.defineProperty(n,"__esModule",{value:!0})}));
!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((n=n||self).vega={})}(this,(function(n){"use strict";function t(n,t,r){return n.fields=t||[],n.fname=r,n}function r(n){return null==n?null:n.fields}function e(n){throw Error(n)}function u(n){var t,r,u,o=[],i=null,c=0,f=n.length,l="";function a(){o.push(l+n.substring(t,r)),l="",t=r+1}for(n+="",t=r=0;r<f;++r)if("\\"===(u=n[r]))l+=n.substring(t,r),l+=n.substring(++r,++r),t=r;else if(u===i)a(),i=null,c=-1;else{if(i)continue;t===c&&'"'===u||t===c&&"'"===u?(t=r+1,i=u):"."!==u||c?"["===u?(r>t&&a(),c=t=r+1):"]"===u&&(c||e("Access path missing open bracket: "+n),c>0&&a(),c=0,t=r+1):r>t?a():t=r+1}return c&&e("Access path missing closing bracket: "+n),i&&e("Access path missing closing quote: "+n),r>t&&(r++,a()),o}var o=Array.isArray;function i(n){return n===Object(n)}function c(n){return"string"==typeof n}function f(n){return o(n)?"["+n.map(f)+"]":i(n)||c(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function l(n,r){var e=u(n),o="return _["+e.map(f).join("][")+"];";return t(Function("_",o),[n=1===e.length?e[0]:n],r||n)}var a=[],s=l("id"),h=t((function(n){return n}),a,"identity"),g=t((function(){return 0}),a,"zero"),p=t((function(){return 1}),a,"one"),v=t((function(){return!0}),a,"true"),m=t((function(){return!1}),a,"false");function y(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}function b(n,t,r,e){var u,c;if(i(r)&&!o(r))for(u in c=i(n[t])?n[t]:n[t]={},r)e&&(!0===e||e[u])?b(c,u,r[u]):c[u]=r[u];else n[t]=r}function d(n,t){if(null==n)return t;const r={},e=[];function u(n){r[n.name]||(r[n.name]=1,e.push(n))}return t.forEach(u),n.forEach(u),e}function M(n){return n[n.length-1]}function j(n){return null==n||""===n?null:+n}function O(n){return function(t){return n*Math.exp(t)}}function w(n){return function(t){return Math.log(n*t)}}function x(n){return function(t){return Math.sign(t)*Math.log1p(Math.abs(t/n))}}function z(n){return function(t){return Math.sign(t)*Math.expm1(Math.abs(t))*n}}function E(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function D(n,t,r,e){var u=r(n[0]),o=r(M(n)),i=(o-u)*t;return[e(u-i),e(o-i)]}function k(n,t,r,e,u){var o=e(n[0]),i=e(M(n)),c=null!=t?e(t):(o+i)/2;return[u(c+(o-c)*r),u(c+(i-c)*r)]}function A(n){return null!=n?o(n)?n:[n]:[]}function S(n){return"function"==typeof n}const N=Object.prototype.hasOwnProperty;function R(n,t){return N.call(n,t)}var F={};function P(n){return"[object Date]"===Object.prototype.toString.call(n)}function _(n){return"number"==typeof n}function C(n,t){for(var r="";--t>=0;)r+=n;return r}function L(n){return _(n)||P(n)?n:Date.parse(n)}n.Debug=4,n.Error=1,n.Info=3,n.None=0,n.Warn=2,n.accessor=t,n.accessorFields=r,n.accessorName=function(n){return null==n?null:n.fname},n.array=A,n.clampRange=function(n,t,r){var e,u=n[0],o=n[1];return o<u&&(e=o,o=u,u=e),(e=o-u)>=r-t?[t,r]:[u=Math.min(Math.max(u,t),r-e),u+e]},n.compare=function(n,e){var o,i,c,l,a,s,h,g,p,v=[],m=(n=A(n)).map((function(n,t){return null==n?null:(v.push(t),S(n)?n:u(n).map(f).join("]["))})),y=v.length-1,b=A(e),d="var u,v;return ";if(y<0)return null;for(i=0;i<=y;++i)S(c=m[o=v[i]])?(l="(u=this."+(s="f"+o)+"(a))",a="(v=this."+s+"(b))",(h=h||{})[s]=c):(l="(u=a["+c+"])",a="(v=b["+c+"])"),s="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==b[o]?(p=1,g=-1):(p=-1,g=1),d+="("+l+"<"+a+"||u==null)&&v!=null?"+g+":(u>v||v==null)&&u!=null?"+p+":"+s+"!==u&&v===v?"+g+":v!==v&&u===u?"+p+(o<y?":":":0");return c=Function("a","b",d+";"),h&&(c=c.bind(h)),n=n.reduce((function(n,t){return S(t)?(r(t)||[]).forEach((function(t){n[t]=1})):null!=t&&(n[t+""]=1),n}),{}),t(c,Object.keys(n))},n.constant=function(n){return S(n)?n:function(){return n}},n.debounce=function(n,t){var r,e;function u(){t(e),r=e=null}return function(t){e=t,r&&clearTimeout(r),r=setTimeout(u,n)}},n.error=e,n.extend=function(n){for(var t,r,e=1,u=arguments.length;e<u;++e)for(r in t=arguments[e])n[r]=t[r];return n},n.extent=function(n,t){var r,e,u,o,i=0;if(n&&(r=n.length))if(null==t){for(e=n[i];i<r&&(null==e||e!=e);e=n[++i]);for(u=o=e;i<r;++i)null!=(e=n[i])&&(e<u&&(u=e),e>o&&(o=e))}else{for(e=t(n[i]);i<r&&(null==e||e!=e);e=t(n[++i]));for(u=o=e;i<r;++i)null!=(e=t(n[i]))&&(e<u&&(u=e),e>o&&(o=e))}return[u,o]},n.extentIndex=function(n,t){var r,e,u,o,i,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(e=n[c])&&e>=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++c<f;)null!=(e=n[c])&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}else{for(;++c<f;)if(null!=(e=t(n[c],c,n))&&e>=e){r=u=e;break}if(c===f)return[-1,-1];for(o=i=c;++c<f;)null!=(e=t(n[c],c,n))&&(r>e&&(r=e,o=c),u<e&&(u=e,i=c))}return[o,i]},n.falsy=m,n.fastmap=function(n){var t,r,e={};function u(n){return R(e,n)&&e[n]!==F}return t={size:0,empty:0,object:e,has:u,get:function(n){return u(n)?e[n]:void 0},set:function(n,r){return u(n)||(++t.size,e[n]===F&&--t.empty),e[n]=r,this},delete:function(n){return u(n)&&(--t.size,++t.empty,e[n]=F),this},clear:function(){t.size=t.empty=0,t.object=e={}},test:function(n){return arguments.length?(r=n,t):r},clean:function(){var n,u,o={},i=0;for(n in e)(u=e[n])===F||r&&r(u)||(o[n]=u,++i);t.size=i,t.empty=0,t.object=e=o}},n&&Object.keys(n).forEach((function(r){t.set(r,n[r])})),t},n.field=l,n.flush=function(n,t,r,e,u,o){if(!r&&0!==r)return o;var i,c,f=n[0],l=M(n),a=+r;return l<f&&(i=f,f=l,l=i),(i=Math.abs(t-f))<(c=Math.abs(l-t))&&i<=a?e:c<=a?u:o},n.hasOwnProperty=R,n.id=s,n.identity=h,n.inherits=function(n,t){var r=n.prototype=Object.create(t.prototype);return r.constructor=n,r},n.inrange=function(n,t,r,e){var u,o=t[0],i=t[t.length-1];return o>i&&(u=o,o=i,i=u),e=void 0===e||e,((r=void 0===r||r)?o<=n:o<n)&&(e?n<=i:n<i)},n.isArray=o,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=P,n.isFunction=S,n.isNumber=_,n.isObject=i,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=c,n.key=function(n,r){return n&&(n=r?A(n).map((function(n){return n.replace(/\\(.)/g,"$1")})):A(n)),t(n&&n.length?Function("_","return ''+"+n.map((function(n){return"_["+(r?f(n):u(n).map(f).join("]["))+"]"})).join("+'|'+")+";"):function(){return""},n,"key")},n.lerp=function(n,t){const r=n[0],e=M(n),u=+t;return u?1===u?e:r+u*(e-r):r},n.logger=function(n,t){var r=n||0;return{level:function(n){return arguments.length?(r=+n,this):r},error:function(){return r>=1&&y(t||"error","ERROR",arguments),this},warn:function(){return r>=2&&y(t||"warn","WARN",arguments),this},info:function(){return r>=3&&y(t||"log","INFO",arguments),this},debug:function(){return r>=4&&y(t||"log","DEBUG",arguments),this}}},n.lruCache=function(n){let t,r,e;n=+n||1e4;const u=()=>{t={},r={},e=0},o=(u,o)=>(++e>n&&(r=t,t={},e=1),t[u]=o);return u(),{clear:u,has:n=>R(t,n)||R(r,n),get:n=>R(t,n)?t[n]:R(r,n)?o(n,r[n]):void 0,set:(n,r)=>R(t,n)?t[n]=r:o(n,r)}},n.merge=function(n,t,r,e){var u=t.length,o=r.length;if(!o)return t;if(!u)return r;for(var i=e||new t.constructor(u+o),c=0,f=0,l=0;c<u&&f<o;++l)i[l]=n(t[c],r[f])>0?r[f++]:t[c++];for(;c<u;++c,++l)i[l]=t[c];for(;f<o;++f,++l)i[l]=r[f];return i},n.mergeConfig=function(...n){return n.reduce((n,t)=>{for(var r in t)if("signals"===r)n.signals=d(n.signals,t.signals);else{var e="legend"===r?{layout:1}:"style"===r||null;b(n,r,t[r],e)}return n},{})},n.one=p,n.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?C(u,i)+o:"center"===e?C(u,~~(i/2))+o+C(u,Math.ceil(i/2)):o+C(u,i)},n.panLinear=function(n,t){return D(n,t,j,h)},n.panLog=function(n,t){var r=Math.sign(n[0]);return D(n,t,w(r),O(r))},n.panPow=function(n,t,r){return D(n,t,E(r),E(1/r))},n.panSymlog=function(n,t,r){return D(n,t,x(r),z(r))},n.peek=M,n.quarter=function(n){return 1+~~(new Date(n).getMonth()/3)},n.repeat=C,n.span=function(n){return n&&M(n)-n[0]||0},n.splitAccessPath=u,n.stringValue=f,n.toBoolean=function(n){return null==n||""===n?null:!(!n||"false"===n||"0"===n)&&!!n},n.toDate=function(n,t){return t=t||L,null==n||""===n?null:t(n)},n.toNumber=j,n.toSet=function(n){for(var t={},r=0,e=n.length;r<e;++r)t[n[r]]=!0;return t},n.toString=function(n){return null==n||""===n?null:n+""},n.truncate=function(n,t,r,e){var u=null!=e?e:"…",o=n+"",i=o.length,c=Math.max(0,t-u.length);return i<=t?o:"left"===r?u+o.slice(i-c):"center"===r?o.slice(0,Math.ceil(c/2))+u+o.slice(i-~~(c/2)):o.slice(0,c)+u},n.truthy=v,n.utcquarter=function(n){return 1+~~(new Date(n).getUTCMonth()/3)},n.visitArray=function(n,t,r){if(n){var e,u=0,o=n.length;if(t)for(;u<o;++u)(e=t(n[u]))&&r(e,u,n);else n.forEach(r)}},n.writeConfig=b,n.zero=g,n.zoomLinear=function(n,t,r){return k(n,t,r,j,h)},n.zoomLog=function(n,t,r){var e=Math.sign(n[0]);return k(n,t,r,w(e),O(e))},n.zoomPow=function(n,t,r,e){return k(n,t,r,E(e),E(1/e))},n.zoomSymlog=function(n,t,r,e){return k(n,t,r,x(e),z(e))},Object.defineProperty(n,"__esModule",{value:!0})}));

@@ -71,2 +71,3 @@ export {

export {default as lerp} from './src/lerp';
export {default as lruCache} from './src/lruCache';
export {default as merge} from './src/merge';

@@ -73,0 +74,0 @@ export {default as pad} from './src/pad';

{
"name": "vega-util",
"version": "1.12.2",
"version": "1.13.0",
"description": "JavaScript utilities for Vega.",

@@ -25,3 +25,3 @@ "keywords": [

},
"gitHead": "178cab5429841aaf02d164753a0621e89d1dce9a"
"gitHead": "49a57c10b309addc513a52a38e1959ee169d4758"
}

@@ -222,2 +222,23 @@ # vega-util

<a name="lruCache" href="#lruCache">#</a>
vega.<b>lruCache</b>([<i>maxsize</i>])
[<>](https://github.com/vega/vega/blob/master/packages/vega-util/src/lruCache.js "Source")
Provides a key/value cache, keyed by string, that evicts least recently used (LRU) entries. Supports *has*, *get*, *set*, and *clear* methods. The optional *maxsize* argument (default 10,000) determines the maximum number of elements that can be added before items are evicted.
In the internal implementation two caches are used: a current cache and a previous cache. When then current cache fills, it becomes the previous cache and a new, empty current cache is created. Subsequent *get* calls will promote elements in the previous cache to the current cache. Once the current cache fills, the caches are again turned over and all LRU items still residing in the previous cache are dropped.
```js
var cache = vega.lruCache(1); // use 1-element cache to demonstrate
cache.set('a', 1); // current cache has a->1
cache.set('b', 2); // current cache has b->2, previous cache has a->1
cache.get('a'); // -> 1 (a now in current cache, b in previous cache)
cache.set('c', 3); // current cache has c->3, previous cache has a->1
cache.has('c'); // -> true (c is in the current cache)
cache.has('b'); // -> false (b has been evicted)
cache.has('a'); // -> true (a is in the previous cache)
cache.get('c'); // -> 3
cache.clear();
```
<a name="fastmap" href="#fastmap">#</a>

@@ -224,0 +245,0 @@ vega.<b>fastmap</b>([<i>object</i>])

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