Socket
Socket
Sign inDemoInstall

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.6.1 to 1.6.2

8

build/vega-util.js

@@ -488,3 +488,8 @@ (function (global, factory) {

var key = function(fields, flat) {
fields = fields ? array(fields) : fields;
if (fields) {
fields = flat
? array(fields).map(function(f) { return f.replace(/\\(.)/g, '$1'); })
: array(fields);
}
var fn = !(fields && fields.length)

@@ -499,2 +504,3 @@ ? function() { return ''; }

}).join('+\'|\'+') + ';');
return accessor(fn, fields, 'key');

@@ -501,0 +507,0 @@ };

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.vega=n.vega||{})}(this,function(n){"use strict";function t(n){return null==n?null:n.fields}function r(n){return h(n)?"["+n.map(r)+"]":g(n)||v(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function e(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}function u(n){return function(t){return n*Math.exp(t)}}function o(n){return function(t){return Math.log(n*t)}}function i(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function c(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 f(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 l(n){return N(n)?n:D(n)?n:Date.parse(n)}var a=function(n,t,r){return n.fields=t||[],n.fname=r,n},s=function(n){throw Error(n)},p=function(n){function t(){o.push(l+n.substring(r,e)),l="",r=e+1}var r,e,u,o=[],i=null,c=0,f=n.length,l="";for(n+="",r=e=0;e<f;++e)if("\\"===(u=n[e]))l+=n.substring(r,e),r=++e;else if(u===i)t(),i=null,c=-1;else{if(i)continue;r===c&&'"'===u?(r=e+1,i=u):r===c&&"'"===u?(r=e+1,i=u):"."!==u||c?"["===u?(e>r&&t(),c=r=e+1):"]"===u&&(c||s("Access path missing open bracket: "+n),c>0&&t(),c=0,r=e+1):e>r?t():r=e+1}return c&&s("Access path missing closing bracket: "+n),i&&s("Access path missing closing quote: "+n),e>r&&(e++,t()),o},h=Array.isArray,g=function(n){return n===Object(n)},v=function(n){return"string"==typeof n},y=function(n,t){var e=p(n),u="return _["+e.map(r).join("][")+"];";return a(Function("_",u),[n=1===e.length?e[0]:n],t||n)},b=[],m=y("id"),d=a(function(n){return n},b,"identity"),j=a(function(){return 0},b,"zero"),O=a(function(){return 1},b,"one"),x=a(function(){return!0},b,"true"),z=a(function(){return!1},b,"false"),M=function(n){return n[n.length-1]},k=function(n){return null==n||""===n?null:+n},w=function(n){return null!=n?h(n)?n:[n]:[]},A=function(n){return"function"==typeof n},E={},D=function(n){return"[object Date]"===Object.prototype.toString.call(n)},N=function(n){return"number"==typeof n},F=function(n,t){for(var r="";--t>=0;)r+=n;return r};n.accessor=a,n.accessorName=function(n){return null==n?null:n.fname},n.accessorFields=t,n.id=m,n.identity=d,n.zero=j,n.one=O,n.truthy=x,n.falsy=z,n.logger=function(n){var t=n||0;return{level:function(n){return arguments.length?(t=+n,this):t},error:function(){return t>=1&&e("error","ERROR",arguments),this},warn:function(){return t>=2&&e("warn","WARN",arguments),this},info:function(){return t>=3&&e("log","INFO",arguments),this},debug:function(){return t>=4&&e("log","DEBUG",arguments),this}}},n.None=0,n.Error=1,n.Warn=2,n.Info=3,n.Debug=4,n.panLinear=function(n,t){return c(n,t,k,d)},n.panLog=function(n,t){var r=Math.sign(n[0]);return c(n,t,o(r),u(r))},n.panPow=function(n,t,r){return c(n,t,i(r),i(1/r))},n.zoomLinear=function(n,t,r){return f(n,t,r,k,d)},n.zoomLog=function(n,t,r){var e=Math.sign(n[0]);return f(n,t,r,o(e),u(e))},n.zoomPow=function(n,t,r,e){return f(n,t,r,i(e),i(1/e))},n.array=w,n.compare=function(n,e){var u,o,i,c,f,l,s,h,g,v=[],y=(n=w(n)).map(function(n,t){return null==n?null:(v.push(t),A(n)?n:p(n).map(r).join("]["))}),b=v.length-1,m=w(e),d="var u,v;return ";if(b<0)return null;for(o=0;o<=b;++o)i=y[u=v[o]],A(i)?(c="(u=this."+(l="f"+u)+"(a))",f="(v=this."+l+"(b))",(s=s||{})[l]=i):(c="(u=a["+i+"])",f="(v=b["+i+"])"),l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==m[u]?(g=1,h=-1):(g=-1,h=1),d+="("+c+"<"+f+"||u==null)&&v!=null?"+h+":(u>v||v==null)&&u!=null?"+g+":"+l+"!==u&&v===v?"+h+":v!==v&&u===u?"+g+(u<b?":":":0");return i=Function("a","b",d+";"),s&&(i=i.bind(s)),n=n.reduce(function(n,r){return A(r)?(t(r)||[]).forEach(function(t){n[t]=1}):null!=r&&(n[r+""]=1),n},{}),a(i,Object.keys(n))},n.constant=function(n){return A(n)?n:function(){return n}},n.debounce=function(n,t){function r(){t(u),e=u=null}var e,u;return function(t){u=t,e&&clearTimeout(e),e=setTimeout(r,n)}},n.error=s,n.extend=function(n){for(var t,r,e=1,u=arguments.length;e<u;++e){t=arguments[e];for(r in t)n[r]=t[r]}return n},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}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}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.fastmap=function(n){function t(n){return u.hasOwnProperty(n)&&u[n]!==E}var r,e,u={};return r={size:0,empty:0,object:u,has:t,get:function(n){return t(n)?u[n]:void 0},set:function(n,e){return t(n)||(++r.size,u[n]===E&&--r.empty),u[n]=e,this},delete:function(n){return t(n)&&(--r.size,++r.empty,u[n]=E),this},clear:function(){r.size=r.empty=0,r.object=u={}},test:function(n){return arguments.length?(e=n,r):e},clean:function(){var n,t,o={},i=0;for(n in u)(t=u[n])===E||e&&e(t)||(o[n]=t,++i);r.size=i,r.empty=0,r.object=u=o}},n&&Object.keys(n).forEach(function(t){r.set(t,n[t])}),r},n.field=y,n.inherits=function(n,t){var r=n.prototype=Object.create(t.prototype);return r.constructor=n,r},n.isArray=h,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=D,n.isFunction=A,n.isNumber=N,n.isObject=g,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=v,n.key=function(n,t){var e=(n=n?w(n):n)&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+(t?r(n):p(n).map(r).join("]["))+"]"}).join("+'|'+")+";"):function(){return""};return a(e,n,"key")},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.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?F(u,i)+o:"center"===e?F(u,~~(i/2))+o+F(u,Math.ceil(i/2)):o+F(u,i)},n.peek=M,n.repeat=F,n.splitAccessPath=p,n.stringValue=r,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=k,n.toString=function(n){return null==n||""===n?null:n+""},n.toSet=function(n){for(var t={},r=0,e=n.length;r<e;++r)t[n[r]]=1;return t},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.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)}},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.vega=n.vega||{})}(this,function(n){"use strict";function t(n){return null==n?null:n.fields}function r(n){return g(n)?"["+n.map(r)+"]":h(n)||v(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function e(n,t,r){var e=[t].concat([].slice.call(r));console[n].apply(console,e)}function u(n){return function(t){return n*Math.exp(t)}}function o(n){return function(t){return Math.log(n*t)}}function i(n){return function(t){return t<0?-Math.pow(-t,n):Math.pow(t,n)}}function c(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 f(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 l(n){return N(n)?n:D(n)?n:Date.parse(n)}var a=function(n,t,r){return n.fields=t||[],n.fname=r,n},s=function(n){throw Error(n)},p=function(n){function t(){o.push(l+n.substring(r,e)),l="",r=e+1}var r,e,u,o=[],i=null,c=0,f=n.length,l="";for(n+="",r=e=0;e<f;++e)if("\\"===(u=n[e]))l+=n.substring(r,e),r=++e;else if(u===i)t(),i=null,c=-1;else{if(i)continue;r===c&&'"'===u?(r=e+1,i=u):r===c&&"'"===u?(r=e+1,i=u):"."!==u||c?"["===u?(e>r&&t(),c=r=e+1):"]"===u&&(c||s("Access path missing open bracket: "+n),c>0&&t(),c=0,r=e+1):e>r?t():r=e+1}return c&&s("Access path missing closing bracket: "+n),i&&s("Access path missing closing quote: "+n),e>r&&(e++,t()),o},g=Array.isArray,h=function(n){return n===Object(n)},v=function(n){return"string"==typeof n},y=function(n,t){var e=p(n),u="return _["+e.map(r).join("][")+"];";return a(Function("_",u),[n=1===e.length?e[0]:n],t||n)},m=[],b=y("id"),d=a(function(n){return n},m,"identity"),j=a(function(){return 0},m,"zero"),O=a(function(){return 1},m,"one"),x=a(function(){return!0},m,"true"),z=a(function(){return!1},m,"false"),M=function(n){return n[n.length-1]},k=function(n){return null==n||""===n?null:+n},w=function(n){return null!=n?g(n)?n:[n]:[]},A=function(n){return"function"==typeof n},E={},D=function(n){return"[object Date]"===Object.prototype.toString.call(n)},N=function(n){return"number"==typeof n},F=function(n,t){for(var r="";--t>=0;)r+=n;return r};n.accessor=a,n.accessorName=function(n){return null==n?null:n.fname},n.accessorFields=t,n.id=b,n.identity=d,n.zero=j,n.one=O,n.truthy=x,n.falsy=z,n.logger=function(n){var t=n||0;return{level:function(n){return arguments.length?(t=+n,this):t},error:function(){return t>=1&&e("error","ERROR",arguments),this},warn:function(){return t>=2&&e("warn","WARN",arguments),this},info:function(){return t>=3&&e("log","INFO",arguments),this},debug:function(){return t>=4&&e("log","DEBUG",arguments),this}}},n.None=0,n.Error=1,n.Warn=2,n.Info=3,n.Debug=4,n.panLinear=function(n,t){return c(n,t,k,d)},n.panLog=function(n,t){var r=Math.sign(n[0]);return c(n,t,o(r),u(r))},n.panPow=function(n,t,r){return c(n,t,i(r),i(1/r))},n.zoomLinear=function(n,t,r){return f(n,t,r,k,d)},n.zoomLog=function(n,t,r){var e=Math.sign(n[0]);return f(n,t,r,o(e),u(e))},n.zoomPow=function(n,t,r,e){return f(n,t,r,i(e),i(1/e))},n.array=w,n.compare=function(n,e){var u,o,i,c,f,l,s,g,h,v=[],y=(n=w(n)).map(function(n,t){return null==n?null:(v.push(t),A(n)?n:p(n).map(r).join("]["))}),m=v.length-1,b=w(e),d="var u,v;return ";if(m<0)return null;for(o=0;o<=m;++o)i=y[u=v[o]],A(i)?(c="(u=this."+(l="f"+u)+"(a))",f="(v=this."+l+"(b))",(s=s||{})[l]=i):(c="(u=a["+i+"])",f="(v=b["+i+"])"),l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))","descending"!==b[u]?(h=1,g=-1):(h=-1,g=1),d+="("+c+"<"+f+"||u==null)&&v!=null?"+g+":(u>v||v==null)&&u!=null?"+h+":"+l+"!==u&&v===v?"+g+":v!==v&&u===u?"+h+(u<m?":":":0");return i=Function("a","b",d+";"),s&&(i=i.bind(s)),n=n.reduce(function(n,r){return A(r)?(t(r)||[]).forEach(function(t){n[t]=1}):null!=r&&(n[r+""]=1),n},{}),a(i,Object.keys(n))},n.constant=function(n){return A(n)?n:function(){return n}},n.debounce=function(n,t){function r(){t(u),e=u=null}var e,u;return function(t){u=t,e&&clearTimeout(e),e=setTimeout(r,n)}},n.error=s,n.extend=function(n){for(var t,r,e=1,u=arguments.length;e<u;++e){t=arguments[e];for(r in t)n[r]=t[r]}return n},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}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}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.fastmap=function(n){function t(n){return u.hasOwnProperty(n)&&u[n]!==E}var r,e,u={};return r={size:0,empty:0,object:u,has:t,get:function(n){return t(n)?u[n]:void 0},set:function(n,e){return t(n)||(++r.size,u[n]===E&&--r.empty),u[n]=e,this},delete:function(n){return t(n)&&(--r.size,++r.empty,u[n]=E),this},clear:function(){r.size=r.empty=0,r.object=u={}},test:function(n){return arguments.length?(e=n,r):e},clean:function(){var n,t,o={},i=0;for(n in u)(t=u[n])===E||e&&e(t)||(o[n]=t,++i);r.size=i,r.empty=0,r.object=u=o}},n&&Object.keys(n).forEach(function(t){r.set(t,n[t])}),r},n.field=y,n.inherits=function(n,t){var r=n.prototype=Object.create(t.prototype);return r.constructor=n,r},n.isArray=g,n.isBoolean=function(n){return"boolean"==typeof n},n.isDate=D,n.isFunction=A,n.isNumber=N,n.isObject=h,n.isRegExp=function(n){return"[object RegExp]"===Object.prototype.toString.call(n)},n.isString=v,n.key=function(n,t){n&&(n=t?w(n).map(function(n){return n.replace(/\\(.)/g,"$1")}):w(n));var e=n&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+(t?r(n):p(n).map(r).join("]["))+"]"}).join("+'|'+")+";"):function(){return""};return a(e,n,"key")},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.pad=function(n,t,r,e){var u=r||" ",o=n+"",i=t-o.length;return i<=0?o:"left"===e?F(u,i)+o:"center"===e?F(u,~~(i/2))+o+F(u,Math.ceil(i/2)):o+F(u,i)},n.peek=M,n.repeat=F,n.splitAccessPath=p,n.stringValue=r,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=k,n.toString=function(n){return null==n||""===n?null:n+""},n.toSet=function(n){for(var t={},r=0,e=n.length;r<e;++r)t[n[r]]=1;return t},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.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)}},Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "vega-util",
"version": "1.6.1",
"version": "1.6.2",
"description": "JavaScript utilities for Vega.",

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

@@ -7,3 +7,8 @@ import accessor from './accessor';

export default function(fields, flat) {
fields = fields ? array(fields) : fields;
if (fields) {
fields = flat
? array(fields).map(function(f) { return f.replace(/\\(.)/g, '$1'); })
: array(fields);
}
var fn = !(fields && fields.length)

@@ -18,3 +23,4 @@ ? function() { return ''; }

}).join('+\'|\'+') + ';');
return accessor(fn, fields, 'key');
}
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