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.1.1 to 1.1.2

11

build/vega-util.js

@@ -55,5 +55,10 @@ (function (global, factory) {

var field = function(field, name) {
var path = splitAccessPath(field).map($),
fn = Function('_', 'return _[' + path.join('][') + '];');
return accessor(fn, [field], name || field);
var path = splitAccessPath(field),
code = 'return _[' + path.map($).join('][') + '];';
return accessor(
Function('_', code),
[(field = path.length===1 ? path[0] : field)],
name || field
);
}

@@ -60,0 +65,0 @@

@@ -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.fname}function e(n){return null==n?null:n.fields}function r(n){return"["!==n[0]?n:"'"!==n[1]&&'"'!==n[1]?n.slice(1,-1):n.slice(2,-2).replace(/\\(["'])/g,"$1")}function u(n){return f(n)?"["+n.map(u)+"]":l(n)||a(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function i(n,t,e){var r=[t].concat([].slice.call(e));console[n].apply(console,r)}var o=function(n,t,e){return n.fields=t||[],n.fname=e,n},c=function(n){return String(n).match(/\[(.*?)\]|[^.\[]+/g).map(r)},f=Array.isArray,l=function(n){return n===Object(n)},a=function(n){return"string"==typeof n},s=function(n,t){var e=c(n).map(u),r=Function("_","return _["+e.join("][")+"];");return o(r,[n],t||n)},p=[],v=s("id"),h=o(function(n){return n},p,"identity"),g=o(function(){return 0},p,"zero"),y=o(function(){return 1},p,"one"),d=o(function(){return!0},p,"true"),m=o(function(){return!1},p,"false"),b=0,j=1,O=2,x=3,z=function(n){var t=n||b;return{level:function(n){return arguments.length?(t=+n,this):t},warn:function(){return t>=j&&i("warn","WARN",arguments),this},info:function(){return t>=O&&i("log","INFO",arguments),this},debug:function(){return t>=x&&i("log","DEBUG",arguments),this}}},k=function(n){return null!=n?f(n)?n:[n]:[]},A=function(n,t){if(null==n)return null;n=k(n);var e,r,i,f,l,a,s,p=n.map(function(n){return c(n).map(u).join("][")}),v=k(t),h=p.length-1,g="var u,v;return ";for(e=0;e<=h;++e)r=p[e],i="(u=a["+r+"])",f="(v=b["+r+"])",l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))",a="descending"!==v[e]?(s=1,-1):(s=-1,1),g+="("+i+"<"+f+"||u==null)&&v!=null?"+a+":(u>v||v==null)&&u!=null?"+s+":"+l+"!==u&&v===v?"+a+":v!==v&&u===u?"+s+(e<h?":":":0");return o(Function("a","b",g+";"),n)},F=function(n){return"function"==typeof n},N=function(n){return F(n)?n:function(){return n}},_=function(n){throw Error(n)},w=function(n){for(var t,e,r=1,u=arguments.length;r<u;++r){t=arguments[r];for(e in t)n[e]=t[e]}return n},D=function(n,t){var e,r,u,i,o,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(r=n[c])&&r>=r){e=u=r;break}for(i=o=c;++c<f;)null!=(r=n[c])&&(e>r&&(e=r,i=c),u<r&&(u=r,o=c))}else{for(;++c<f;)if(null!=(r=t(n[c],c,n))&&r>=r){e=u=r;break}for(i=o=c;++c<f;)null!=(r=t(n[c],c,n))&&(e>r&&(e=r,i=c),u<r&&(u=r,o=c))}return[i,o]},E={},M=function(n){function t(n){return u.hasOwnProperty(n)&&u[n]!==E}var e,r,u={};return e={size:0,empty:0,object:u,has:t,get:function(n){return t(n)?u[n]:void 0},set:function(n,r){return t(n)||(++e.size,u[n]===E&&--e.empty),u[n]=r,this},delete:function(n){return t(n)&&(--e.size,++e.empty,u[n]=E),this},clear:function(){e.size=e.empty=0,e.object=u={}},test:function(n){return arguments.length?(r=n,e):r},clean:function(){var n,t,i={},o=0;for(n in u)t=u[n],t===E||r&&r(t)||(i[n]=t,++o);e.size=o,e.empty=0,e.object=u=i}},n&&Object.keys(n).forEach(function(t){e.set(t,n[t])}),e},S=function(n,t){var e=n.prototype=Object.create(t.prototype);return e.constructor=n,e},I=function(n){return"number"==typeof n},P=function(n){n=n?k(n):n;var t=n&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+c(n).map(u).join("][")+"]"}).join("+'|'+")+";"):function(){return""};return o(t,n,"key")},W=function(n,t,e,r){var u=t.length,i=e.length;if(!i)return t;if(!u)return e;for(var o=r||new t.constructor(u+i),c=0,f=0,l=0;c<u&&f<i;++l)o[l]=n(t[c],e[f])>0?e[f++]:t[c++];for(;c<u;++c,++l)o[l]=t[c];for(;f<i;++f,++l)o[l]=e[f];return o},B=function(n,t){for(var e="";--t>=0;)e+=n;return e},G=function(n,t,e,r){var u=e||" ",i=n+"",o=t-i.length;return o<=0?i:"left"===r?B(u,o)+i:"center"===r?B(u,~~(o/2))+i+B(u,Math.ceil(o/2)):i+B(u,o)},J=function(n){return n[n.length-1]},R=function(n){for(var t={},e=0,r=n.length;e<r;++e)t[n[e]]=1;return t},U=function(n,t,e,r){var u=null!=r?r:"…",i=n+"",o=i.length,c=Math.max(0,t-u.length);return o<=t?i:"left"===e?u+i.slice(o-c):"center"===e?i.slice(0,Math.ceil(c/2))+u+i.slice(o-~~(c/2)):i.slice(0,c)+u},V=function(n,t,e){if(n){var r,u=0,i=n.length;if(t)for(;u<i;++u)(r=t(n[u]))&&e(r,u,n);else n.forEach(e)}};n.accessor=o,n.accessorName=t,n.accessorFields=e,n.id=v,n.identity=h,n.zero=g,n.one=y,n.truthy=d,n.falsy=m,n.logger=z,n.None=b,n.Warn=j,n.Info=O,n.Debug=x,n.array=k,n.compare=A,n.constant=N,n.error=_,n.extend=w,n.extentIndex=D,n.fastmap=M,n.field=s,n.inherits=S,n.isArray=f,n.isFunction=F,n.isNumber=I,n.isObject=l,n.isString=a,n.key=P,n.merge=W,n.pad=G,n.peek=J,n.repeat=B,n.splitAccessPath=c,n.stringValue=u,n.toSet=R,n.truncate=U,n.visitArray=V,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.fname}function e(n){return null==n?null:n.fields}function r(n){return"["!==n[0]?n:"'"!==n[1]&&'"'!==n[1]?n.slice(1,-1):n.slice(2,-2).replace(/\\(["'])/g,"$1")}function u(n){return f(n)?"["+n.map(u)+"]":l(n)||a(n)?JSON.stringify(n).replace("\u2028","\\u2028").replace("\u2029","\\u2029"):n}function i(n,t,e){var r=[t].concat([].slice.call(e));console[n].apply(console,r)}var o=function(n,t,e){return n.fields=t||[],n.fname=e,n},c=function(n){return String(n).match(/\[(.*?)\]|[^.\[]+/g).map(r)},f=Array.isArray,l=function(n){return n===Object(n)},a=function(n){return"string"==typeof n},s=function(n,t){var e=c(n),r="return _["+e.map(u).join("][")+"];";return o(Function("_",r),[n=1===e.length?e[0]:n],t||n)},p=[],v=s("id"),h=o(function(n){return n},p,"identity"),g=o(function(){return 0},p,"zero"),y=o(function(){return 1},p,"one"),d=o(function(){return!0},p,"true"),m=o(function(){return!1},p,"false"),b=0,j=1,O=2,x=3,z=function(n){var t=n||b;return{level:function(n){return arguments.length?(t=+n,this):t},warn:function(){return t>=j&&i("warn","WARN",arguments),this},info:function(){return t>=O&&i("log","INFO",arguments),this},debug:function(){return t>=x&&i("log","DEBUG",arguments),this}}},k=function(n){return null!=n?f(n)?n:[n]:[]},A=function(n,t){if(null==n)return null;n=k(n);var e,r,i,f,l,a,s,p=n.map(function(n){return c(n).map(u).join("][")}),v=k(t),h=p.length-1,g="var u,v;return ";for(e=0;e<=h;++e)r=p[e],i="(u=a["+r+"])",f="(v=b["+r+"])",l="((v=v instanceof Date?+v:v),(u=u instanceof Date?+u:u))",a="descending"!==v[e]?(s=1,-1):(s=-1,1),g+="("+i+"<"+f+"||u==null)&&v!=null?"+a+":(u>v||v==null)&&u!=null?"+s+":"+l+"!==u&&v===v?"+a+":v!==v&&u===u?"+s+(e<h?":":":0");return o(Function("a","b",g+";"),n)},F=function(n){return"function"==typeof n},N=function(n){return F(n)?n:function(){return n}},_=function(n){throw Error(n)},w=function(n){for(var t,e,r=1,u=arguments.length;r<u;++r){t=arguments[r];for(e in t)n[e]=t[e]}return n},D=function(n,t){var e,r,u,i,o,c=-1,f=n.length;if(null==t){for(;++c<f;)if(null!=(r=n[c])&&r>=r){e=u=r;break}for(i=o=c;++c<f;)null!=(r=n[c])&&(e>r&&(e=r,i=c),u<r&&(u=r,o=c))}else{for(;++c<f;)if(null!=(r=t(n[c],c,n))&&r>=r){e=u=r;break}for(i=o=c;++c<f;)null!=(r=t(n[c],c,n))&&(e>r&&(e=r,i=c),u<r&&(u=r,o=c))}return[i,o]},E={},M=function(n){function t(n){return u.hasOwnProperty(n)&&u[n]!==E}var e,r,u={};return e={size:0,empty:0,object:u,has:t,get:function(n){return t(n)?u[n]:void 0},set:function(n,r){return t(n)||(++e.size,u[n]===E&&--e.empty),u[n]=r,this},delete:function(n){return t(n)&&(--e.size,++e.empty,u[n]=E),this},clear:function(){e.size=e.empty=0,e.object=u={}},test:function(n){return arguments.length?(r=n,e):r},clean:function(){var n,t,i={},o=0;for(n in u)t=u[n],t===E||r&&r(t)||(i[n]=t,++o);e.size=o,e.empty=0,e.object=u=i}},n&&Object.keys(n).forEach(function(t){e.set(t,n[t])}),e},S=function(n,t){var e=n.prototype=Object.create(t.prototype);return e.constructor=n,e},I=function(n){return"number"==typeof n},P=function(n){n=n?k(n):n;var t=n&&n.length?Function("_","return ''+"+n.map(function(n){return"_["+c(n).map(u).join("][")+"]"}).join("+'|'+")+";"):function(){return""};return o(t,n,"key")},W=function(n,t,e,r){var u=t.length,i=e.length;if(!i)return t;if(!u)return e;for(var o=r||new t.constructor(u+i),c=0,f=0,l=0;c<u&&f<i;++l)o[l]=n(t[c],e[f])>0?e[f++]:t[c++];for(;c<u;++c,++l)o[l]=t[c];for(;f<i;++f,++l)o[l]=e[f];return o},B=function(n,t){for(var e="";--t>=0;)e+=n;return e},G=function(n,t,e,r){var u=e||" ",i=n+"",o=t-i.length;return o<=0?i:"left"===r?B(u,o)+i:"center"===r?B(u,~~(o/2))+i+B(u,Math.ceil(o/2)):i+B(u,o)},J=function(n){return n[n.length-1]},R=function(n){for(var t={},e=0,r=n.length;e<r;++e)t[n[e]]=1;return t},U=function(n,t,e,r){var u=null!=r?r:"…",i=n+"",o=i.length,c=Math.max(0,t-u.length);return o<=t?i:"left"===e?u+i.slice(o-c):"center"===e?i.slice(0,Math.ceil(c/2))+u+i.slice(o-~~(c/2)):i.slice(0,c)+u},V=function(n,t,e){if(n){var r,u=0,i=n.length;if(t)for(;u<i;++u)(r=t(n[u]))&&e(r,u,n);else n.forEach(e)}};n.accessor=o,n.accessorName=t,n.accessorFields=e,n.id=v,n.identity=h,n.zero=g,n.one=y,n.truthy=d,n.falsy=m,n.logger=z,n.None=b,n.Warn=j,n.Info=O,n.Debug=x,n.array=k,n.compare=A,n.constant=N,n.error=_,n.extend=w,n.extentIndex=D,n.fastmap=M,n.field=s,n.inherits=S,n.isArray=f,n.isFunction=F,n.isNumber=I,n.isObject=l,n.isString=a,n.key=P,n.merge=W,n.pad=G,n.peek=J,n.repeat=B,n.splitAccessPath=c,n.stringValue=u,n.toSet=R,n.truncate=U,n.visitArray=V,Object.defineProperty(n,"__esModule",{value:!0})});
{
"name": "vega-util",
"version": "1.1.1",
"version": "1.1.2",
"description": "JavaScript utilities for Vega.",

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

@@ -202,2 +202,3 @@ # vega-util

vega.<b>inherits</b>(<i>child</i>, <i>parent</i>)
[<>](https://github.com/vega/vega-util/blob/master/src/inherits.js "Source")

@@ -211,2 +212,3 @@ A convenience method for setting up object-oriented inheritance. Assigns the

vega.<b>fastmap</b>([<i>object</i>])
[<>](https://github.com/vega/vega-util/blob/master/src/fastmap.js "Source")

@@ -213,0 +215,0 @@ Provides a key/value map data structure, keyed by string. Supports a subset

@@ -6,5 +6,10 @@ import accessor from './accessor';

export default function(field, name) {
var path = splitAccessPath(field).map(stringValue),
fn = Function('_', 'return _[' + path.join('][') + '];');
return accessor(fn, [field], name || field);
var path = splitAccessPath(field),
code = 'return _[' + path.map(stringValue).join('][') + '];';
return accessor(
Function('_', code),
[(field = path.length===1 ? path[0] : field)],
name || field
);
}
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