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

vega-loader

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vega-loader - npm Package Compare versions

Comparing version 2.0.0-beta.6 to 2.0.0-beta.7

12

build/vega-loader.js

@@ -276,5 +276,11 @@ (function (global, factory) {

var json = function(data, format) {
data = vegaUtil.isObject(data) && !isBuffer(data) ? data : JSON.parse(data);
return (format && format.property)
? vegaUtil.field(format.property)(data)
var prop = (format && format.property) ? vegaUtil.field(format.property) : vegaUtil.identity;
return vegaUtil.isObject(data) && !isBuffer(data)
? parseJSON(prop(data))
: prop(JSON.parse(data));
}
function parseJSON(data, format) {
return (format && format.copy)
? JSON.parse(JSON.stringify(data))
: data;

@@ -281,0 +287,0 @@ }

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("d3-request"),require("d3-dsv"),require("topojson"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-request","d3-dsv","topojson","d3-time-format"],n):n(e.vega=e.vega||{},e.vega,e.d3,e.d3,e.topojson,e.d3)}(this,function(e,n,r,t,o,i){"use strict";function u(e,r){return n.extend({},e.options,r)}function f(e,n){var r=this;return r.sanitize(e,n).then(function(e){var t=e.href;return d(t,F)?r.file(t.slice(F.length)):r.http(t,n)})}function s(e,r){return r=u(this,r),new Promise(function(t,o){var i,u,f,s;return null==e||"string"!=typeof e?void o("Sanitize failure, invalid URI: "+n.stringValue(e)):(u=B.test(e),(s=r.baseURL)&&!u&&(d(e,"/")||"/"===s[s.length-1]||(e="/"+e),e=s+e),f=(i=d(e,F))||"file"===r.mode||"http"!==r.mode&&!u&&c(),f?e=(i?"":F)+e:d(e,"//")&&(e=(r.defaultProtocol||"http")+":"+e),void t({href:e}))})}function a(e,n){return n=u(this,n),new Promise(function(t,o){var i,u=r.request(e);for(i in n.headers)u.header(i,n.headers[i]);I.forEach(function(e){n[e]&&u[e](n[e])}),u.on("error",function(n){o(n||"Error loading URL: "+e)}).on("load",function(e){var n=e&&e.responseText;e&&0!==e.status?t(n):o(n||"Error")}).get()})}function l(e){return new Promise(function(n,r){var t=c();t?t.readFile(e,function(e,t){e?r(e):n(t)}):r("No file system access for "+e)})}function c(){var e="function"==typeof require&&require("fs");return e&&n.isFunction(e.readFile)?e:null}function d(e,n){return null!=e&&0===e.lastIndexOf(n,0)}function p(e,n){var r,t,o,i,u=E.slice();for(t=0,o=e.length;t<o;++t){for(r=n?e[t][n]:e[t],i=0;i<u.length;++i)j(r)&&!u[i](r)&&(u.splice(i,1),--i);if(0===u.length)return"string"}return J[E.indexOf(u[0])]}function h(e,n){return n.reduce(function(n,r){return n[r]=p(e,r),n},{})}function m(e){return null==e||""===e?null:+e}function v(e){return null==e||""===e?null:!(!e||"false"===e)&&!!e}function g(e,n){return null==e||""===e?null:n?n(e):Date.parse(e)}function y(e){return null==e||""===e?null:e+""}function j(e){return null!=e&&e===e}function b(e){return"true"===e||"false"===e||e===!0||e===!1}function O(e){return!isNaN(Date.parse(e))}function q(e){return!(isNaN(+e)||e instanceof Date)}function x(e){return q(e)&&(e=+e)===~~e}function P(e){return function(r,t){var o={delimiter:e};return N(r,t?n.extend(t,o):o)}}function N(e,r){return r.header&&(e=r.header.map(n.stringValue).join(r.delimiter)+"\n"+e),t.dsvFormat(r.delimiter).parse(e+"")}function w(e){return!("function"!=typeof Buffer||!n.isFunction(Buffer.isBuffer))&&Buffer.isBuffer(e)}function T(e,n,r){r=r||i.timeParse;var t,o,u,f,s,a,l,c=e.columns||Object.keys(e[0]);for("auto"===n&&(n=h(e,c)),c=Object.keys(n),t=c.map(function(e){var t,o,u=n[e];if(u&&(0===u.indexOf("date:")||0===u.indexOf("utc:")))return t=u.split(/:(.+)?/,2),o=t[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1)),"utc"===t[0]?i.utcParse(o):r(o);if(!z[u])throw Error("Illegal format pattern: "+e+":"+u);return z[u]}),f=0,a=e.length,l=c.length;f<a;++f)for(o=e[f],s=0;s<l;++s)u=c[s],o[u]=t[s](o[u])}var B=/^([A-Za-z]+:)?\/\//,F="file://",I=["mimeType","responseType","user","password"],S=function(e){return{options:e||{},sanitize:s,load:f,file:l,http:a}},z={boolean:v,integer:m,number:m,date:g,string:y},E=[b,x,q,O],J=["boolean","integer","number","date"],U=function(e,r){return e=n.isObject(e)&&!w(e)?e:JSON.parse(e),r&&r.property?n.field(r.property)(e):e},k=function(e,r){var t,i;return e=U(e,r),r&&(i=r.feature)?(t=e.objects[i])?o.feature(e,t).features:n.error("Invalid TopoJSON object: "+i):r&&(i=r.mesh)?(t=e.objects[i])?[o.mesh(e,t)]:n.error("Invalid TopoJSON object: "+i):void n.error("Missing TopoJSON feature or mesh parameter.")},D={dsv:N,csv:P(","),tsv:P("\t"),json:U,topojson:k},R=function(e,n){return arguments.length>1?(D[e]=n,this):D.hasOwnProperty(e)?D[e]:null},L=function(e,r,t){r=r||{};var o=R(r.type||"json");return o||n.error("Unknown data format type: "+r.type),e=o(e,r),r.parse&&T(e,r.parse,t),e.hasOwnProperty("columns")&&delete e.columns,e};e.loader=S,e.read=L,e.inferType=p,e.inferTypes=h,e.typeParsers=z,e.formats=R,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("vega-util"),require("d3-request"),require("d3-dsv"),require("topojson"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-request","d3-dsv","topojson","d3-time-format"],n):n(e.vega=e.vega||{},e.vega,e.d3,e.d3,e.topojson,e.d3)}(this,function(e,n,r,t,o,i){"use strict";function u(e,r){return n.extend({},e.options,r)}function f(e,n){var r=this;return r.sanitize(e,n).then(function(e){var t=e.href;return d(t,B)?r.file(t.slice(B.length)):r.http(t,n)})}function s(e,r){return r=u(this,r),new Promise(function(t,o){var i,u,f,s;return null==e||"string"!=typeof e?void o("Sanitize failure, invalid URI: "+n.stringValue(e)):(u=J.test(e),(s=r.baseURL)&&!u&&(d(e,"/")||"/"===s[s.length-1]||(e="/"+e),e=s+e),f=(i=d(e,B))||"file"===r.mode||"http"!==r.mode&&!u&&c(),f?e=(i?"":B)+e:d(e,"//")&&(e=(r.defaultProtocol||"http")+":"+e),void t({href:e}))})}function a(e,n){return n=u(this,n),new Promise(function(t,o){var i,u=r.request(e);for(i in n.headers)u.header(i,n.headers[i]);F.forEach(function(e){n[e]&&u[e](n[e])}),u.on("error",function(n){o(n||"Error loading URL: "+e)}).on("load",function(e){var n=e&&e.responseText;e&&0!==e.status?t(n):o(n||"Error")}).get()})}function l(e){return new Promise(function(n,r){var t=c();t?t.readFile(e,function(e,t){e?r(e):n(t)}):r("No file system access for "+e)})}function c(){var e="function"==typeof require&&require("fs");return e&&n.isFunction(e.readFile)?e:null}function d(e,n){return null!=e&&0===e.lastIndexOf(n,0)}function p(e,n){var r,t,o,i,u=E.slice();for(t=0,o=e.length;t<o;++t){for(r=n?e[t][n]:e[t],i=0;i<u.length;++i)j(r)&&!u[i](r)&&(u.splice(i,1),--i);if(0===u.length)return"string"}return U[E.indexOf(u[0])]}function h(e,n){return n.reduce(function(n,r){return n[r]=p(e,r),n},{})}function m(e){return null==e||""===e?null:+e}function v(e){return null==e||""===e?null:!(!e||"false"===e)&&!!e}function g(e,n){return null==e||""===e?null:n?n(e):Date.parse(e)}function y(e){return null==e||""===e?null:e+""}function j(e){return null!=e&&e===e}function O(e){return"true"===e||"false"===e||e===!0||e===!1}function b(e){return!isNaN(Date.parse(e))}function N(e){return!(isNaN(+e)||e instanceof Date)}function q(e){return N(e)&&(e=+e)===~~e}function x(e){return function(r,t){var o={delimiter:e};return P(r,t?n.extend(t,o):o)}}function P(e,r){return r.header&&(e=r.header.map(n.stringValue).join(r.delimiter)+"\n"+e),t.dsvFormat(r.delimiter).parse(e+"")}function w(e){return!("function"!=typeof Buffer||!n.isFunction(Buffer.isBuffer))&&Buffer.isBuffer(e)}function T(e,n){return n&&n.copy?JSON.parse(JSON.stringify(e)):e}function S(e,n,r){r=r||i.timeParse;var t,o,u,f,s,a,l,c=e.columns||Object.keys(e[0]);for("auto"===n&&(n=h(e,c)),c=Object.keys(n),t=c.map(function(e){var t,o,u=n[e];if(u&&(0===u.indexOf("date:")||0===u.indexOf("utc:")))return t=u.split(/:(.+)?/,2),o=t[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1)),"utc"===t[0]?i.utcParse(o):r(o);if(!z[u])throw Error("Illegal format pattern: "+e+":"+u);return z[u]}),f=0,a=e.length,l=c.length;f<a;++f)for(o=e[f],s=0;s<l;++s)u=c[s],o[u]=t[s](o[u])}var J=/^([A-Za-z]+:)?\/\//,B="file://",F=["mimeType","responseType","user","password"],I=function(e){return{options:e||{},sanitize:s,load:f,file:l,http:a}},z={boolean:v,integer:m,number:m,date:g,string:y},E=[O,q,N,b],U=["boolean","integer","number","date"],k=function(e,r){var t=r&&r.property?n.field(r.property):n.identity;return n.isObject(e)&&!w(e)?T(t(e)):t(JSON.parse(e))},D=function(e,r){var t,i;return e=k(e,r),r&&(i=r.feature)?(t=e.objects[i])?o.feature(e,t).features:n.error("Invalid TopoJSON object: "+i):r&&(i=r.mesh)?(t=e.objects[i])?[o.mesh(e,t)]:n.error("Invalid TopoJSON object: "+i):void n.error("Missing TopoJSON feature or mesh parameter.")},R={dsv:P,csv:x(","),tsv:x("\t"),json:k,topojson:D},L=function(e,n){return arguments.length>1?(R[e]=n,this):R.hasOwnProperty(e)?R[e]:null},M=function(e,r,t){r=r||{};var o=L(r.type||"json");return o||n.error("Unknown data format type: "+r.type),e=o(e,r),r.parse&&S(e,r.parse,t),e.hasOwnProperty("columns")&&delete e.columns,e};e.loader=I,e.read=M,e.inferType=p,e.inferTypes=h,e.typeParsers=z,e.formats=L,Object.defineProperty(e,"__esModule",{value:!0})});
{
"name": "vega-loader",
"version": "2.0.0-beta.6",
"version": "2.0.0-beta.7",
"description": "Network request and file loading utilities.",

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

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

import {field, isFunction, isObject} from 'vega-util';
import {field, identity, isFunction, isObject} from 'vega-util';

@@ -9,6 +9,12 @@ function isBuffer(_) {

export default function(data, format) {
data = isObject(data) && !isBuffer(data) ? data : JSON.parse(data);
return (format && format.property)
? field(format.property)(data)
var prop = (format && format.property) ? field(format.property) : identity;
return isObject(data) && !isBuffer(data)
? parseJSON(prop(data))
: prop(JSON.parse(data));
}
function parseJSON(data, format) {
return (format && format.copy)
? JSON.parse(JSON.stringify(data))
: data;
}
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