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.15.1 to 1.15.2

build/vega-util.min.js.map

411

build/vega-util.js

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

function accessor(fn, fields, name) {
function accessor (fn, fields, name) {
fn.fields = fields || [];

@@ -13,7 +13,5 @@ fn.fname = name;

}
function accessorName(fn) {
return fn == null ? null : fn.fname;
}
function accessorFields(fn) {

@@ -23,7 +21,7 @@ return fn == null ? null : fn.fields;

function getter(path) {
function getter (path) {
return path.length === 1 ? get1(path[0]) : getN(path);
}
const get1 = field => function(obj) {
const get1 = field => function (obj) {
return obj[field];

@@ -34,6 +32,7 @@ };

const len = path.length;
return function(obj) {
return function (obj) {
for (let i = 0; i < len; ++i) {
obj = obj[path[i]];
}
return obj;

@@ -43,15 +42,15 @@ };

function error(message) {
function error (message) {
throw Error(message);
}
function splitAccessPath(p) {
function splitAccessPath (p) {
const path = [],
n = p.length;
let q = null,
b = 0,
s = '',
i, j, c;
i,
j,
c;
p = p + '';

@@ -65,4 +64,5 @@

for (i=j=0; j<n; ++j) {
for (i = j = 0; j < n; ++j) {
c = p[j];
if (c === '\\') {

@@ -112,22 +112,13 @@ s += p.substring(i, j);

function field(field, name, opt) {
function field (field, name, opt) {
const path = splitAccessPath(field);
field = path.length === 1 ? path[0] : field;
return accessor(
(opt && opt.get || getter)(path),
[field],
name || field
);
return accessor((opt && opt.get || getter)(path), [field], name || field);
}
const id = field('id');
const identity = accessor(_ => _, [], 'identity');
const zero = accessor(() => 0, [], 'zero');
const one = accessor(() => 1, [], 'one');
const truthy = accessor(() => true, [], 'true');
const falsy = accessor(() => false, [], 'false');

@@ -140,9 +131,8 @@

const None = 0;
const None = 0;
const Error$1 = 1;
const Warn = 2;
const Info = 3;
const Warn = 2;
const Info = 3;
const Debug = 4;
function logger(_, method) {
function logger (_, method) {
let level = _ || None;

@@ -158,2 +148,3 @@ return {

},
error() {

@@ -163,2 +154,3 @@ if (level >= Error$1) log(method || 'error', 'ERROR', arguments);

},
warn() {

@@ -168,2 +160,3 @@ if (level >= Warn) log(method || 'warn', 'WARN', arguments);

},
info() {

@@ -173,2 +166,3 @@ if (level >= Info) log(method || 'log', 'INFO', arguments);

},
debug() {

@@ -178,2 +172,3 @@ if (level >= Debug) log(method || 'log', 'DEBUG', arguments);

}
};

@@ -184,3 +179,3 @@ }

function isObject(_) {
function isObject (_) {
return _ === Object(_);

@@ -204,18 +199,19 @@ }

// otherwise, no recursion: objects overwrite, no merging
const r = key === 'legend' ? {layout: 1}
: key === 'style' ? true
: null;
const r = key === 'legend' ? {
layout: 1
} : key === 'style' ? true : null;
writeConfig(out, key, source[key], r);
}
}
return out;
}, {});
}
function writeConfig(output, key, value, recurse) {
if (!isLegalKey(key)) return;
let k, o;
let k, o;
if (isObject(value) && !isArray(value)) {
o = isObject(output[key]) ? output[key] : (output[key] = {});
o = isObject(output[key]) ? output[key] : output[key] = {};
for (k in value) {

@@ -235,5 +231,5 @@ if (recurse && (recurse === true || recurse[k])) {

if (a == null) return b;
const map = {},
out = [];
const map = {}, out = [];
function add(_) {

@@ -251,24 +247,19 @@ if (!map[_.name]) {

function peek(array) {
function peek (array) {
return array[array.length - 1];
}
function toNumber(_) {
function toNumber (_) {
return _ == null || _ === '' ? null : +_;
}
const exp = sign =>
x => sign * Math.exp(x);
const exp = sign => x => sign * Math.exp(x);
const log$1 = sign =>
x => Math.log(sign * x);
const log$1 = sign => x => Math.log(sign * x);
const symlog = c =>
x => Math.sign(x) * Math.log1p(Math.abs(x / c));
const symlog = c => x => Math.sign(x) * Math.log1p(Math.abs(x / c));
const symexp = c =>
x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
const symexp = c => x => Math.sign(x) * Math.expm1(Math.abs(x)) * c;
const pow = exponent =>
x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);
const pow = exponent => x => x < 0 ? -Math.pow(-x, exponent) : Math.pow(x, exponent);

@@ -279,7 +270,3 @@ function pan(domain, delta, lift, ground) {

dd = (d1 - d0) * delta;
return [
ground(d0 - dd),
ground(d1 - dd)
];
return [ground(d0 - dd), ground(d1 - dd)];
}

@@ -290,3 +277,2 @@

}
function panLog(domain, delta) {

@@ -296,7 +282,5 @@ var sign = Math.sign(domain[0]);

}
function panPow(domain, delta, exponent) {
return pan(domain, delta, pow(exponent), pow(1/exponent));
return pan(domain, delta, pow(exponent), pow(1 / exponent));
}
function panSymlog(domain, delta, constant) {

@@ -310,7 +294,3 @@ return pan(domain, delta, symlog(constant), symexp(constant));

da = anchor != null ? lift(anchor) : (d0 + d1) / 2;
return [
ground(da + (d0 - da) * scale),
ground(da + (d1 - da) * scale)
];
return [ground(da + (d0 - da) * scale), ground(da + (d1 - da) * scale)];
}

@@ -321,3 +301,2 @@

}
function zoomLog(domain, anchor, scale) {

@@ -327,7 +306,5 @@ const sign = Math.sign(domain[0]);

}
function zoomPow(domain, anchor, scale, exponent) {
return zoom(domain, anchor, scale, pow(exponent), pow(1/exponent));
return zoom(domain, anchor, scale, pow(exponent), pow(1 / exponent));
}
function zoomSymlog(domain, anchor, scale, constant) {

@@ -340,3 +317,2 @@ return zoom(domain, anchor, scale, symlog(constant), symexp(constant));

}
function utcquarter(date) {

@@ -346,4 +322,4 @@ return 1 + ~~(new Date(date).getUTCMonth() / 3);

function array(_) {
return _ != null ? (isArray(_) ? _ : [_]) : [];
function array (_) {
return _ != null ? isArray(_) ? _ : [_] : [];
}

@@ -358,3 +334,3 @@

*/
function clampRange(range, min, max) {
function clampRange (range, min, max) {
let lo = range[0],

@@ -369,13 +345,8 @@ hi = range[1],

}
span = hi - lo;
return span >= (max - min)
? [min, max]
: [
(lo = Math.min(Math.max(lo, min), max - span)),
lo + span
];
return span >= max - min ? [min, max] : [lo = Math.min(Math.max(lo, min), max - span), lo + span];
}
function isFunction(_) {
function isFunction (_) {
return typeof _ === 'function';

@@ -385,10 +356,9 @@ }

const DESCENDING = 'descending';
function compare(fields, orders, opt) {
function compare (fields, orders, opt) {
opt = opt || {};
orders = array(orders) || [];
const ord = [], get = [], fmap = {},
const ord = [],
get = [],
fmap = {},
gen = opt.comparator || comparator;
array(fields).forEach((f, i) => {

@@ -400,19 +370,9 @@ if (f == null) return;

});
return get.length === 0
? null
: accessor(gen(get, ord), Object.keys(fmap));
return get.length === 0 ? null : accessor(gen(get, ord), Object.keys(fmap));
}
const ascending = (u, v) => (u < v || u == null) && v != null ? -1 : (u > v || v == null) && u != null ? 1 : (v = v instanceof Date ? +v : v, u = u instanceof Date ? +u : u) !== u && v === v ? -1 : v !== v && u === u ? 1 : 0;
const ascending = (u, v) => (u < v || u == null) && v != null ? -1
: (u > v || v == null) && u != null ? 1
: ((v = v instanceof Date ? +v : v), (u = u instanceof Date ? +u : u)) !== u && v === v ? -1
: v !== v && u === u ? 1
: 0;
const comparator = (fields, orders) => fields.length === 1 ? compare1(fields[0], orders[0]) : compareN(fields, orders, fields.length);
const comparator = (fields, orders) => fields.length === 1
? compare1(fields[0], orders[0])
: compareN(fields, orders, fields.length);
const compare1 = (field, order) => function(a, b) {
const compare1 = (field, order) => function (a, b) {
return ascending(field(a), field(b)) * order;

@@ -423,4 +383,8 @@ };

orders.push(0); // pad zero for convenient lookup
return function(a, b) {
let f, c = 0, i = -1;
return function (a, b) {
let f,
c = 0,
i = -1;
while (c === 0 && ++i < n) {

@@ -430,2 +394,3 @@ f = fields[i];

}
return c * orders[i];

@@ -435,23 +400,23 @@ };

function constant(_) {
function constant (_) {
return isFunction(_) ? _ : () => _;
}
function debounce(delay, handler) {
function debounce (delay, handler) {
let tid;
return e => {
if (tid) clearTimeout(tid);
tid = setTimeout(
() => (handler(e), tid = null),
delay
);
tid = setTimeout(() => (handler(e), tid = null), delay);
};
}
function extend(_) {
for (let x, k, i=1, len=arguments.length; i<len; ++i) {
function extend (_) {
for (let x, k, i = 1, len = arguments.length; i < len; ++i) {
x = arguments[i];
for (k in x) { _[k] = x[k]; }
for (k in x) {
_[k] = x[k];
}
}
return _;

@@ -464,4 +429,8 @@ }

*/
function extent(array, f) {
let i = 0, n, v, min, max;
function extent (array, f) {
let i = 0,
n,
v,
min,
max;

@@ -472,8 +441,8 @@ if (array && (n = array.length)) {

for (v = array[i]; i < n && (v == null || v !== v); v = array[++i]);
min = max = v;
// visit all other values
for (; i<n; ++i) {
v = array[i];
// skip null/undefined; NaN will fail all comparisons
min = max = v; // visit all other values
for (; i < n; ++i) {
v = array[i]; // skip null/undefined; NaN will fail all comparisons
if (v != null) {

@@ -487,8 +456,8 @@ if (v < min) min = v;

for (v = f(array[i]); i < n && (v == null || v !== v); v = f(array[++i]));
min = max = v;
// visit all other values
for (; i<n; ++i) {
v = f(array[i]);
// skip null/undefined; NaN will fail all comparisons
min = max = v; // visit all other values
for (; i < n; ++i) {
v = f(array[i]); // skip null/undefined; NaN will fail all comparisons
if (v != null) {

@@ -505,5 +474,10 @@ if (v < min) min = v;

function extentIndex(array, f) {
function extentIndex (array, f) {
const n = array.length;
let i = -1, a, b, c, u, v;
let i = -1,
a,
b,
c,
u,
v;

@@ -513,2 +487,3 @@ if (f == null) {

b = array[i];
if (b != null && b >= b) {

@@ -519,6 +494,9 @@ a = c = b;

}
if (i === n) return [-1, -1];
u = v = i;
while (++i < n) {
b = array[i];
if (b != null) {

@@ -529,2 +507,3 @@ if (a > b) {

}
if (c < b) {

@@ -539,2 +518,3 @@ c = b;

b = f(array[i], i, array);
if (b != null && b >= b) {

@@ -545,6 +525,9 @@ a = c = b;

}
if (i === n) return [-1, -1];
u = v = i;
while (++i < n) {
b = f(array[i], i, array);
if (b != null) {

@@ -555,2 +538,3 @@ if (a > b) {

}
if (c < b) {

@@ -568,4 +552,3 @@ c = b;

const hop = Object.prototype.hasOwnProperty;
function has(object, property) {
function has (object, property) {
return hop.call(object, property);

@@ -575,4 +558,3 @@ }

const NULL = {};
function fastmap(input) {
function fastmap (input) {
let obj = {},

@@ -590,5 +572,7 @@ test;

has: has$1,
get(key) {
return has$1(key) ? obj[key] : undefined;
},
set(key, value) {

@@ -599,5 +583,7 @@ if (!has$1(key)) {

}
obj[key] = value;
return this;
},
delete(key) {

@@ -609,4 +595,6 @@ if (has$1(key)) {

}
return this;
},
clear() {

@@ -616,2 +604,3 @@ map.size = map.empty = 0;

},
test(_) {

@@ -625,7 +614,10 @@ if (arguments.length) {

},
clean() {
const next = {};
let size = 0;
for (const key in obj) {
const value = obj[key];
if (value !== NULL && (!test || !test(value))) {

@@ -636,38 +628,37 @@ next[key] = value;

}
map.size = size;
map.empty = 0;
map.object = (obj = next);
map.object = obj = next;
}
};
if (input) Object.keys(input).forEach(key => {
map.set(key, input[key]);
});
return map;
}
function flush(range, value, threshold, left, right, center) {
function flush (range, value, threshold, left, right, center) {
if (!threshold && threshold !== 0) return center;
const t = +threshold;
let a = range[0],
b = peek(range),
l;
l; // swap endpoints if range is reversed
// swap endpoints if range is reversed
if (b < a) {
l = a; a = b; b = l;
}
l = a;
a = b;
b = l;
} // compare value to endpoints
// compare value to endpoints
l = Math.abs(value - a);
const r = Math.abs(b - value);
const r = Math.abs(b - value); // adjust if value is within threshold distance of endpoint
// adjust if value is within threshold distance of endpoint
return l < r && l <= t ? left : r <= t ? right : center;
}
function inherits(child, parent, members) {
const proto = (child.prototype = Object.create(parent.prototype));
function inherits (child, parent, members) {
const proto = child.prototype = Object.create(parent.prototype);
proto.constructor = child;

@@ -682,4 +673,7 @@ return extend(proto, members);

*/
function inrange(value, range, left, right) {
let r0 = range[0], r1 = range[range.length-1], t;
function inrange (value, range, left, right) {
let r0 = range[0],
r1 = range[range.length - 1],
t;
if (r0 > r1) {

@@ -690,34 +684,31 @@ t = r0;

}
left = left === undefined || left;
right = right === undefined || right;
return (left ? r0 <= value : r0 < value) &&
(right ? value <= r1 : value < r1);
return (left ? r0 <= value : r0 < value) && (right ? value <= r1 : value < r1);
}
function isBoolean(_) {
function isBoolean (_) {
return typeof _ === 'boolean';
}
function isDate(_) {
function isDate (_) {
return Object.prototype.toString.call(_) === '[object Date]';
}
function isNumber(_) {
function isNumber (_) {
return typeof _ === 'number';
}
function isRegExp(_) {
function isRegExp (_) {
return Object.prototype.toString.call(_) === '[object RegExp]';
}
function isString(_) {
function isString (_) {
return typeof _ === 'string';
}
function key(fields, flat, opt) {
function key (fields, flat, opt) {
if (fields) {
fields = flat
? array(fields).map(f => f.replace(/\\(.)/g, '$1'))
: array(fields);
fields = flat ? array(fields).map(f => f.replace(/\\(.)/g, '$1')) : array(fields);
}

@@ -728,14 +719,24 @@

map = f => gen(flat ? [f] : splitAccessPath(f));
let fn;
if (!len) {
fn = function() { return ''; };
fn = function () {
return '';
};
} else if (len === 1) {
const get = map(fields[0]);
fn = function(_) { return '' + get(_); };
fn = function (_) {
return '' + get(_);
};
} else {
const get = fields.map(map);
fn = function(_) {
let s = '' + get[0](_), i = 0;
fn = function (_) {
let s = '' + get[0](_),
i = 0;
while (++i < len) s += '|' + get[i](_);
return s;

@@ -748,3 +749,3 @@ };

function lerp(array, frac) {
function lerp (array, frac) {
const lo = array[0],

@@ -756,8 +757,6 @@ hi = peek(array),

const DEFAULT_MAX_SIZE = 10000;
const DEFAULT_MAX_SIZE = 10000; // adapted from https://github.com/dominictarr/hashlru/ (MIT License)
// adapted from https://github.com/dominictarr/hashlru/ (MIT License)
function lruCache(maxsize) {
function lruCache (maxsize) {
maxsize = +maxsize || DEFAULT_MAX_SIZE;
let curr, prev, size;

@@ -777,40 +776,34 @@

}
return (curr[key] = value);
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)
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) {
function merge (compare, array0, array1, output) {
const n0 = array0.length,
n1 = array1.length;
if (!n1) return array0;
if (!n0) return array1;
const merged = output || new array0.constructor(n0 + n1);
let i0 = 0, i1 = 0, i = 0;
let i0 = 0,
i1 = 0,
i = 0;
for (; i0<n0 && i1<n1; ++i) {
merged[i] = compare(array0[i0], array1[i1]) > 0
? array1[i1++]
: array0[i0++];
for (; i0 < n0 && i1 < n1; ++i) {
merged[i] = compare(array0[i0], array1[i1]) > 0 ? array1[i1++] : array0[i0++];
}
for (; i0<n0; ++i0, ++i) {
for (; i0 < n0; ++i0, ++i) {
merged[i] = array0[i0];
}
for (; i1<n1; ++i1, ++i) {
for (; i1 < n1; ++i1, ++i) {
merged[i] = array1[i1];

@@ -822,17 +815,15 @@ }

function repeat(str, reps) {
function repeat (str, reps) {
let s = '';
while (--reps >= 0) s += str;
return s;
}
function pad(str, length, padchar, align) {
function pad (str, length, padchar, align) {
const c = padchar || ' ',
s = str + '',
n = length - s.length;
return n <= 0 ? s
: align === 'left' ? repeat(c, n) + s
: align === 'center' ? repeat(c, ~~(n/2)) + s + repeat(c, Math.ceil(n/2))
: s + repeat(c, n);
return n <= 0 ? s : align === 'left' ? repeat(c, n) + s : align === 'center' ? repeat(c, ~~(n / 2)) + s + repeat(c, Math.ceil(n / 2)) : s + repeat(c, n);
}

@@ -844,23 +835,20 @@

*/
function span(array) {
return array && (peek(array) - array[0]) || 0;
function span (array) {
return array && peek(array) - array[0] || 0;
}
function $(x) {
return isArray(x) ? '[' + x.map($) + ']'
: isObject(x) || isString(x) ?
// Output valid JSON and JS source strings.
// See http://timelessrepo.com/json-isnt-a-javascript-subset
JSON.stringify(x).replace('\u2028','\\u2028').replace('\u2029', '\\u2029')
: x;
return isArray(x) ? '[' + x.map($) + ']' : isObject(x) || isString(x) ? // Output valid JSON and JS source strings.
// See http://timelessrepo.com/json-isnt-a-javascript-subset
JSON.stringify(x).replace('\u2028', '\\u2028').replace('\u2029', '\\u2029') : x;
}
function toBoolean(_) {
function toBoolean (_) {
return _ == null || _ === '' ? null : !_ || _ === 'false' || _ === '0' ? false : !!_;
}
const defaultParser = _ =>
isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);
const defaultParser = _ => isNumber(_) ? _ : isDate(_) ? _ : Date.parse(_);
function toDate(_, parser) {
function toDate (_, parser) {
parser = parser || defaultParser;

@@ -870,14 +858,16 @@ return _ == null || _ === '' ? null : parser(_);

function toString(_) {
function toString (_) {
return _ == null || _ === '' ? null : _ + '';
}
function toSet(_) {
function toSet (_) {
const s = {},
n = _.length;
for (let i=0; i<n; ++i) s[_[i]] = true;
for (let i = 0; i < n; ++i) s[_[i]] = true;
return s;
}
function truncate(str, length, align, ellipsis) {
function truncate (str, length, align, ellipsis) {
const e = ellipsis != null ? ellipsis : '\u2026',

@@ -887,13 +877,10 @@ s = str + '',

l = Math.max(0, length - e.length);
return n <= length ? s
: align === 'left' ? e + s.slice(n - l)
: align === 'center' ? s.slice(0, Math.ceil(l/2)) + e + s.slice(n - ~~(l/2))
: s.slice(0, l) + e;
return n <= length ? s : align === 'left' ? e + s.slice(n - l) : align === 'center' ? s.slice(0, Math.ceil(l / 2)) + e + s.slice(n - ~~(l / 2)) : s.slice(0, l) + e;
}
function visitArray(array, filter, visitor) {
function visitArray (array, filter, visitor) {
if (array) {
if (filter) {
const n = array.length;
for (let i = 0; i < n; ++i) {

@@ -900,0 +887,0 @@ const t = filter(array[i]);

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

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

@@ -12,16 +12,14 @@ "keywords": [

"main": "build/vega-util.js",
"module": "index",
"module": "build/vega-util.module.js",
"unpkg": "build/vega-util.min.js",
"types": "index.d.ts",
"repository": "vega/vega",
"scripts": {
"rollup": "rollup -f umd -n vega -o build/vega-util.js -- index.js",
"prebuild": "rimraf build && mkdir build",
"build": "yarn rollup",
"postbuild": "terser build/vega-util.js -c -m -o build/vega-util.min.js",
"pretest": "yarn prebuild && yarn rollup",
"prebuild": "rimraf build",
"build": "rollup -c",
"pretest": "yarn build --config-test",
"test": "tape 'test/**/*-test.js'",
"prepublishOnly": "yarn test && yarn build",
"postpublish": "git push && git push --tags"
"prepublishOnly": "yarn test && yarn build"
},
"gitHead": "8d6793f4ca7eaaf2d22186764e9ce2dae687cf52"
"gitHead": "4affcbedb9d14815dbb6d3b250ed231b54fc95c0"
}
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