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.8 to 2.0.0

27

build/vega-loader.js
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-request'), require('d3-dsv'), require('topojson'), require('d3-time-format')) :
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-request', 'd3-dsv', 'topojson', 'd3-time-format'], factory) :
(factory((global.vega = global.vega || {}),global.vega,global.d3,global.d3,global.topojson,global.d3));
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-request'), require('d3-dsv'), require('topojson'), require('d3-time-format')) :
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-request', 'd3-dsv', 'topojson', 'd3-time-format'], factory) :
(factory((global.vega = global.vega || {}),global.vega,global.d3,global.d3,global.topojson,global.d3));
}(this, (function (exports,vegaUtil,d3Request,d3Dsv,topojson,d3TimeFormat) { 'use strict';

@@ -36,3 +36,3 @@

};
}
};

@@ -210,3 +210,4 @@ function marshall(loader, options) {

return fields.reduce(function(types, field$$1) {
return types[field$$1] = inferType(data, field$$1), types;
types[field$$1] = inferType(data, field$$1);
return types;
}, {});

@@ -263,3 +264,3 @@ }

: prop(JSON.parse(data));
}
};

@@ -289,3 +290,3 @@ function parseJSON(data, format) {

vegaUtil.error('Missing TopoJSON feature or mesh parameter.');
}
};

@@ -301,5 +302,9 @@ var formats = {

var formats$1 = function(name, format) {
return arguments.length > 1 ? (formats[name] = format, this)
: formats.hasOwnProperty(name) ? formats[name] : null;
}
if (arguments.length > 1) {
formats[name] = format;
return this;
} else {
return formats.hasOwnProperty(name) ? formats[name] : null;
}
};

@@ -317,3 +322,3 @@ var read = function(data, schema, dateParse) {

return data;
}
};

@@ -320,0 +325,0 @@ function parse(data, types, dateParse) {

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

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

@@ -46,6 +46,6 @@ "keywords": [

"devDependencies": {
"eslint": "2",
"rollup": "0.36",
"eslint": "4",
"rollup": "0.43",
"tape": "4",
"uglify-js": "2"
"uglify-js": "3"
},

@@ -56,2 +56,2 @@ "browser": {

}
}
}

@@ -14,4 +14,8 @@ import {default as dsv, delimitedFormat} from './dsv';

export default function(name, format) {
return arguments.length > 1 ? (formats[name] = format, this)
: formats.hasOwnProperty(name) ? formats[name] : null;
if (arguments.length > 1) {
formats[name] = format;
return this;
} else {
return formats.hasOwnProperty(name) ? formats[name] : null;
}
}

@@ -43,3 +43,4 @@ import {toBoolean, toDate, toNumber, toString} from 'vega-util';

return fields.reduce(function(types, field) {
return types[field] = inferType(data, field), types;
types[field] = inferType(data, field);
return types;
}, {});

@@ -46,0 +47,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