vega-loader
Advanced tools
Comparing version 4.2.1 to 4.2.2
@@ -226,10 +226,9 @@ (function (global, factory) { | ||
var value, i, j, t = 0, | ||
n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map(function(_, i) { return i + 1; }); | ||
const n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map((_, i) => i + 1); | ||
for (i=0, n=values.length; i<n; ++i) { | ||
for (let i = 0, t = 0, j, value; i < n; ++i) { | ||
value = field ? values[i][field] : values[i]; | ||
for (j=0; j<m; ++j) { | ||
for (j = 0; j < m; ++j) { | ||
if (a[j] && isValid(value) && !typeTests[j](value)) { | ||
@@ -243,4 +242,5 @@ a[j] = 0; | ||
t = a.reduce(function(u, v) { return u === 0 ? v : u; }, 0) - 1; | ||
return typeList[t]; | ||
return typeList[ | ||
a.reduce((u, v) => u === 0 ? v : u, 0) - 1 | ||
]; | ||
} | ||
@@ -247,0 +247,0 @@ |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-dsv"),require("topojson-client"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-dsv","topojson-client","d3-time-format"],t):t((e=e||self).vega={},e.vega,e.d3,e.topojson,e.d3)}(this,(function(e,t,n,r,o){"use strict";const i=/^([A-Za-z]+:)?\/\//,s=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,u=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function a(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function f(e,n){n=t.extend({},this.options,n);const r=this.fileAccess,o={href:null};let a,f,c;const l=s.test(e.replace(u,""));null!=e&&"string"==typeof e&&l||t.error("Sanitize failure, invalid URI: "+t.stringValue(e));const p=i.test(e);return(c=n.baseURL)&&!p&&(e.startsWith("/")||"/"===c[c.length-1]||(e="/"+e),e=c+e),f=(a=e.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!p&&r,a?e=e.slice("file://".length):e.startsWith("//")&&("file"===n.defaultProtocol?(e=e.slice(2),f=!0):e=(n.defaultProtocol||"http")+":"+e),Object.defineProperty(o,"localFile",{value:!!f}),o.href=e,n.target&&(o.target=n.target+""),n.rel&&(o.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(o.crossOrigin=n.crossOrigin+""),o}function c(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:l}async function l(){t.error("No file system access.")}function p(e){return e?async function(n,r){const o=t.extend({},this.options.http,r),i=r&&r.response,s=await e(n,o);return s.ok?t.isFunction(s[i])?s[i]():s.text():t.error(s.status+""+s.statusText)}:d}async function d(){t.error("No HTTP fetch method available.")}var h={boolean:t.toBoolean,integer:t.toNumber,number:t.toNumber,date:t.toDate,string:t.toString,unknown:t.identity},m=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return b(e)&&Number.isInteger(+e)},b,function(e){return!Number.isNaN(Date.parse(e))}],g=["boolean","integer","number","date"];function y(e,t){if(!e||!e.length)return"unknown";var n,r,o,i,s=0,u=e.length,a=m.length,f=m.map((function(e,t){return t+1}));for(r=0,u=e.length;r<u;++r)for(n=t?e[r][t]:e[r],o=0;o<a;++o)if(f[o]&&(null!=(i=n)&&i==i)&&!m[o](n)&&(f[o]=0,++s===m.length))return"string";return s=f.reduce((function(e,t){return 0===e?t:e}),0)-1,g[s]}function v(e,t){return t.reduce((function(t,n){return t[n]=y(e,n),t}),{})}function b(e){return!(Number.isNaN(+e)||e instanceof Date)}function j(e){const n=function(n,r){const o={delimiter:e};return N(n,r?t.extend(r,o):o)};return n.responseType="text",n}function N(e,r){return r.header&&(e=r.header.map(t.stringValue).join(r.delimiter)+"\n"+e),n.dsvFormat(r.delimiter).parse(e+"")}function O(e,n){const r=n&&n.property?t.field(n.property):t.identity;return!t.isObject(e)||(o=e,"function"==typeof Buffer&&t.isFunction(Buffer.isBuffer)&&Buffer.isBuffer(o))?r(JSON.parse(e)):function(e,t){return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(r(e));var o}N.responseType="text",O.responseType="json";const x={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function T(e,n){let o,i,s,u;return e=O(e,n),n&&n.feature?(o=r.feature,s=n.feature):n&&n.mesh?(o=r.mesh,s=n.mesh,u=x[n.filter]):t.error("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[s])?o(e,i,u):t.error("Invalid TopoJSON object: "+s),i&&i.features||[i]}T.responseType="json";const P={dsv:N,csv:j(","),tsv:j("\t"),json:O,topojson:T};function w(e,n){return arguments.length>1?(P[e]=n,this):t.hasOwnProperty(P,e)?P[e]:null}var z=function(e,t){return function(n){return{options:n||{},sanitize:f,load:a,fileAccess:!!t,file:c(t),http:p(e)}}}("undefined"!=typeof fetch&&fetch,null);e.format=P,e.formats=w,e.inferType=y,e.inferTypes=v,e.loader=z,e.read=function(e,n,r){const i=w((n=n||{}).type||"json");return i||t.error("Unknown data format type: "+n.type),e=i(e,n),n.parse&&function(e,t,n){if(!e.length)return;n=n||o.timeParse;var r,i,s,u,a,f,c,l=e.columns||Object.keys(e[0]);"auto"===t&&(t=v(e,l));for(l=Object.keys(t),r=l.map((function(e){var r,i,s=t[e];if(s&&(s.startsWith("date:")||s.startsWith("utc:")))return("'"===(i=(r=s.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?o.utcParse(i):n(i);if(!h[s])throw Error("Illegal format pattern: "+e+":"+s);return h[s]})),u=0,f=e.length,c=l.length;u<f;++u)for(i=e[u],a=0;a<c;++a)s=l[a],i[s]=r[a](i[s])}(e,n.parse,r),t.hasOwnProperty(e,"columns")&&delete e.columns,e},e.responseType=function(e){const t=w(e);return t&&t.responseType||"text"},e.typeParsers=h,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega-util"),require("d3-dsv"),require("topojson-client"),require("d3-time-format")):"function"==typeof define&&define.amd?define(["exports","vega-util","d3-dsv","topojson-client","d3-time-format"],t):t((e=e||self).vega={},e.vega,e.d3,e.topojson,e.d3)}(this,(function(e,t,n,r,o){"use strict";const i=/^([A-Za-z]+:)?\/\//,s=/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp|file|data):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i,u=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205f\u3000]/g;async function a(e,t){const n=await this.sanitize(e,t),r=n.href;return n.localFile?this.file(r):this.http(r,t)}async function f(e,n){n=t.extend({},this.options,n);const r=this.fileAccess,o={href:null};let a,f,c;const l=s.test(e.replace(u,""));null!=e&&"string"==typeof e&&l||t.error("Sanitize failure, invalid URI: "+t.stringValue(e));const p=i.test(e);return(c=n.baseURL)&&!p&&(e.startsWith("/")||"/"===c[c.length-1]||(e="/"+e),e=c+e),f=(a=e.startsWith("file://"))||"file"===n.mode||"http"!==n.mode&&!p&&r,a?e=e.slice("file://".length):e.startsWith("//")&&("file"===n.defaultProtocol?(e=e.slice(2),f=!0):e=(n.defaultProtocol||"http")+":"+e),Object.defineProperty(o,"localFile",{value:!!f}),o.href=e,n.target&&(o.target=n.target+""),n.rel&&(o.rel=n.rel+""),"image"===n.context&&n.crossOrigin&&(o.crossOrigin=n.crossOrigin+""),o}function c(e){return e?function(t){return new Promise((function(n,r){e.readFile(t,(function(e,t){e?r(e):n(t)}))}))}:l}async function l(){t.error("No file system access.")}function p(e){return e?async function(n,r){const o=t.extend({},this.options.http,r),i=r&&r.response,s=await e(n,o);return s.ok?t.isFunction(s[i])?s[i]():s.text():t.error(s.status+""+s.statusText)}:d}async function d(){t.error("No HTTP fetch method available.")}var h={boolean:t.toBoolean,integer:t.toNumber,number:t.toNumber,date:t.toDate,string:t.toString,unknown:t.identity},m=[function(e){return"true"===e||"false"===e||!0===e||!1===e},function(e){return b(e)&&Number.isInteger(+e)},b,function(e){return!Number.isNaN(Date.parse(e))}],g=["boolean","integer","number","date"];function y(e,t){if(!e||!e.length)return"unknown";const n=e.length,r=m.length,o=m.map((e,t)=>t+1);for(let s,u,a=0,f=0;a<n;++a)for(u=t?e[a][t]:e[a],s=0;s<r;++s)if(o[s]&&(null!=(i=u)&&i==i)&&!m[s](u)&&(o[s]=0,++f,f===m.length))return"string";var i;return g[o.reduce((e,t)=>0===e?t:e,0)-1]}function v(e,t){return t.reduce((function(t,n){return t[n]=y(e,n),t}),{})}function b(e){return!(Number.isNaN(+e)||e instanceof Date)}function j(e){const n=function(n,r){const o={delimiter:e};return N(n,r?t.extend(r,o):o)};return n.responseType="text",n}function N(e,r){return r.header&&(e=r.header.map(t.stringValue).join(r.delimiter)+"\n"+e),n.dsvFormat(r.delimiter).parse(e+"")}function O(e,n){const r=n&&n.property?t.field(n.property):t.identity;return!t.isObject(e)||(o=e,"function"==typeof Buffer&&t.isFunction(Buffer.isBuffer)&&Buffer.isBuffer(o))?r(JSON.parse(e)):function(e,t){return t&&t.copy?JSON.parse(JSON.stringify(e)):e}(r(e));var o}N.responseType="text",O.responseType="json";const x={interior:(e,t)=>e!==t,exterior:(e,t)=>e===t};function T(e,n){let o,i,s,u;return e=O(e,n),n&&n.feature?(o=r.feature,s=n.feature):n&&n.mesh?(o=r.mesh,s=n.mesh,u=x[n.filter]):t.error("Missing TopoJSON feature or mesh parameter."),i=(i=e.objects[s])?o(e,i,u):t.error("Invalid TopoJSON object: "+s),i&&i.features||[i]}T.responseType="json";const P={dsv:N,csv:j(","),tsv:j("\t"),json:O,topojson:T};function w(e,n){return arguments.length>1?(P[e]=n,this):t.hasOwnProperty(P,e)?P[e]:null}var z=function(e,t){return function(n){return{options:n||{},sanitize:f,load:a,fileAccess:!!t,file:c(t),http:p(e)}}}("undefined"!=typeof fetch&&fetch,null);e.format=P,e.formats=w,e.inferType=y,e.inferTypes=v,e.loader=z,e.read=function(e,n,r){const i=w((n=n||{}).type||"json");return i||t.error("Unknown data format type: "+n.type),e=i(e,n),n.parse&&function(e,t,n){if(!e.length)return;n=n||o.timeParse;var r,i,s,u,a,f,c,l=e.columns||Object.keys(e[0]);"auto"===t&&(t=v(e,l));for(l=Object.keys(t),r=l.map((function(e){var r,i,s=t[e];if(s&&(s.startsWith("date:")||s.startsWith("utc:")))return("'"===(i=(r=s.split(/:(.+)?/,2))[1])[0]&&"'"===i[i.length-1]||'"'===i[0]&&'"'===i[i.length-1])&&(i=i.slice(1,-1)),"utc"===r[0]?o.utcParse(i):n(i);if(!h[s])throw Error("Illegal format pattern: "+e+":"+s);return h[s]})),u=0,f=e.length,c=l.length;u<f;++u)for(i=e[u],a=0;a<c;++a)s=l[a],i[s]=r[a](i[s])}(e,n.parse,r),t.hasOwnProperty(e,"columns")&&delete e.columns,e},e.responseType=function(e){const t=w(e);return t&&t.responseType||"text"},e.typeParsers=h,Object.defineProperty(e,"__esModule",{value:!0})})); |
@@ -229,10 +229,9 @@ 'use strict'; | ||
var value, i, j, t = 0, | ||
n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map(function(_, i) { return i + 1; }); | ||
const n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map((_, i) => i + 1); | ||
for (i=0, n=values.length; i<n; ++i) { | ||
for (let i = 0, t = 0, j, value; i < n; ++i) { | ||
value = field ? values[i][field] : values[i]; | ||
for (j=0; j<m; ++j) { | ||
for (j = 0; j < m; ++j) { | ||
if (a[j] && isValid(value) && !typeTests[j](value)) { | ||
@@ -246,4 +245,5 @@ a[j] = 0; | ||
t = a.reduce(function(u, v) { return u === 0 ? v : u; }, 0) - 1; | ||
return typeList[t]; | ||
return typeList[ | ||
a.reduce((u, v) => u === 0 ? v : u, 0) - 1 | ||
]; | ||
} | ||
@@ -250,0 +250,0 @@ |
{ | ||
"name": "vega-loader", | ||
"version": "4.2.1", | ||
"version": "4.2.2", | ||
"description": "Network request and file loading utilities.", | ||
@@ -32,3 +32,3 @@ "keywords": [ | ||
"pretest": "yarn prebuild && yarn rollup", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js index.browser.js src test", | ||
"test": "tape 'test/**/*-test.js'", | ||
"prepublishOnly": "yarn test && yarn build", | ||
@@ -42,3 +42,3 @@ "postpublish": "git push && git push --tags" | ||
"topojson-client": "^3.1.0", | ||
"vega-util": "^1.13.1" | ||
"vega-util": "^1.13.2" | ||
}, | ||
@@ -49,3 +49,3 @@ "browser": { | ||
}, | ||
"gitHead": "2485e6f68a1cec25260c8c07b812f24925c5d726" | ||
"gitHead": "35e31c5c6b54db9dc3a577b5adad8d15ec274d32" | ||
} |
@@ -1,2 +0,2 @@ | ||
import {default as dsv, delimitedFormat} from './dsv'; | ||
import {delimitedFormat, default as dsv} from './dsv'; | ||
import json from './json'; | ||
@@ -3,0 +3,0 @@ import topojson from './topojson'; |
@@ -1,2 +0,2 @@ | ||
import {extend, error, isFunction, stringValue} from 'vega-util'; | ||
import {error, extend, isFunction, stringValue} from 'vega-util'; | ||
@@ -3,0 +3,0 @@ // Matches absolute URLs with optional protocol |
@@ -29,10 +29,9 @@ import {identity, toBoolean, toDate, toNumber, toString} from 'vega-util'; | ||
var value, i, j, t = 0, | ||
n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map(function(_, i) { return i + 1; }); | ||
const n = values.length, | ||
m = typeTests.length, | ||
a = typeTests.map((_, i) => i + 1); | ||
for (i=0, n=values.length; i<n; ++i) { | ||
for (let i = 0, t = 0, j, value; i < n; ++i) { | ||
value = field ? values[i][field] : values[i]; | ||
for (j=0; j<m; ++j) { | ||
for (j = 0; j < m; ++j) { | ||
if (a[j] && isValid(value) && !typeTests[j](value)) { | ||
@@ -46,4 +45,5 @@ a[j] = 0; | ||
t = a.reduce(function(u, v) { return u === 0 ? v : u; }, 0) - 1; | ||
return typeList[t]; | ||
return typeList[ | ||
a.reduce((u, v) => u === 0 ? v : u, 0) - 1 | ||
]; | ||
} | ||
@@ -50,0 +50,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
58424
Updatedvega-util@^1.13.2