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.3 to 2.0.0-beta.4

3

build/vega-loader.js

@@ -162,3 +162,4 @@ (function (global, factory) {

function fs() {
return typeof require === 'function' && require('fs');
var fs = typeof require === 'function' && require('fs');
return fs && vegaUtil.isFunction(fs.readFile) ? fs : null;
}

@@ -165,0 +166,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,I)?r.file(t.slice(I.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)):((s=r.baseURL)&&!u&&(d(e,"/")||"/"===s[s.length-1]||(e="/"+e),e=s+e),i=d(e,I),u=B.test(e),f=i||"file"===r.mode||"http"!==r.mode&&!u&&c(),f?e=(i?"":I)+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]);S.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(){return"function"==typeof require&&require("fs")}function d(e,n){return null!=e&&0===e.lastIndexOf(n,0)}function p(e,n){var r,t,o,i,u=J.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[J.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 N(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,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,i=n[e];if(i&&0===i.indexOf("date:"))return t=i.split(/:(.+)?/,2),o=t[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1)),r(o);if(!E[i])throw Error("Illegal format pattern: "+e+":"+i);return E[i]}),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]+:)?\/\//,I="file://",S=["mimeType","responseType","user","password"],z=function(e){return{options:e||{},sanitize:s,load:f,file:l,http:a}},E={boolean:v,integer:m,number:m,date:g,string:y},J=[b,x,q,O],U=["boolean","integer","number","date"],k=function(e,r){return e=n.isObject(e)&&!w(e)?e:JSON.parse(e),r&&r.property?n.field(r.property)(e):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.")},F={dsv:P,csv:N(","),tsv:N("\t"),json:k,topojson:D},R=function(e,n){return arguments.length>1?(F[e]=n,this):F.hasOwnProperty(e)?F[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=z,e.read=L,e.inferType=p,e.inferTypes=h,e.typeParsers=E,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,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)):((s=r.baseURL)&&!u&&(d(e,"/")||"/"===s[s.length-1]||(e="/"+e),e=s+e),i=d(e,F),u=B.test(e),f=i||"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 N(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,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,i=n[e];if(i&&0===i.indexOf("date:"))return t=i.split(/:(.+)?/,2),o=t[1],("'"===o[0]&&"'"===o[o.length-1]||'"'===o[0]&&'"'===o[o.length-1])&&(o=o.slice(1,-1)),r(o);if(!z[i])throw Error("Illegal format pattern: "+e+":"+i);return z[i]}),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:P,csv:N(","),tsv:N("\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})});
{
"name": "vega-loader",
"version": "2.0.0-beta.3",
"version": "2.0.0-beta.4",
"description": "Network request and file loading utilities.",

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

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

import {extend, stringValue} from 'vega-util';
import {extend, isFunction, stringValue} from 'vega-util';
import {request} from 'd3-request';

@@ -159,3 +159,4 @@

function fs() {
return typeof require === 'function' && require('fs');
var fs = typeof require === 'function' && require('fs');
return fs && isFunction(fs.readFile) ? fs : null;
}

@@ -162,0 +163,0 @@

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