vega-loader
Advanced tools
Comparing version 4.4.1 to 4.5.0
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-dsv'), require('topojson-client'), require('vega-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-dsv', 'topojson-client', 'vega-format'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.d3, global.topojson, global.vega)); | ||
}(this, (function (exports, vegaUtil, d3Dsv, topojsonClient, vegaFormat) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('topojson-client'), require('vega-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'topojson-client', 'vega-format'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.topojson, global.vega)); | ||
})(this, (function (exports, vegaUtil, topojsonClient, vegaFormat) { 'use strict'; | ||
@@ -232,2 +232,170 @@ // https://... file://... //... | ||
var EOL = {}, | ||
EOF = {}, | ||
QUOTE = 34, | ||
NEWLINE = 10, | ||
RETURN = 13; | ||
function objectConverter(columns) { | ||
return new Function("d", "return {" + columns.map(function (name, i) { | ||
return JSON.stringify(name) + ": d[" + i + "] || \"\""; | ||
}).join(",") + "}"); | ||
} | ||
function customConverter(columns, f) { | ||
var object = objectConverter(columns); | ||
return function (row, i) { | ||
return f(object(row), i, columns); | ||
}; | ||
} // Compute unique columns in order of discovery. | ||
function inferColumns(rows) { | ||
var columnSet = Object.create(null), | ||
columns = []; | ||
rows.forEach(function (row) { | ||
for (var column in row) { | ||
if (!(column in columnSet)) { | ||
columns.push(columnSet[column] = column); | ||
} | ||
} | ||
}); | ||
return columns; | ||
} | ||
function pad(value, width) { | ||
var s = value + "", | ||
length = s.length; | ||
return length < width ? new Array(width - length + 1).join(0) + s : s; | ||
} | ||
function formatYear(year) { | ||
return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); | ||
} | ||
function formatDate(date) { | ||
var hours = date.getUTCHours(), | ||
minutes = date.getUTCMinutes(), | ||
seconds = date.getUTCSeconds(), | ||
milliseconds = date.getUTCMilliseconds(); | ||
return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); | ||
} | ||
function dsvFormat (delimiter) { | ||
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), | ||
DELIMITER = delimiter.charCodeAt(0); | ||
function parse(text, f) { | ||
var convert, | ||
columns, | ||
rows = parseRows(text, function (row, i) { | ||
if (convert) return convert(row, i - 1); | ||
columns = row, convert = f ? customConverter(row, f) : objectConverter(row); | ||
}); | ||
rows.columns = columns || []; | ||
return rows; | ||
} | ||
function parseRows(text, f) { | ||
var rows = [], | ||
// output rows | ||
N = text.length, | ||
I = 0, | ||
// current character index | ||
n = 0, | ||
// current line number | ||
t, | ||
// current token | ||
eof = N <= 0, | ||
// current token followed by EOF? | ||
eol = false; // current token followed by EOL? | ||
// Strip the trailing newline. | ||
if (text.charCodeAt(N - 1) === NEWLINE) --N; | ||
if (text.charCodeAt(N - 1) === RETURN) --N; | ||
function token() { | ||
if (eof) return EOF; | ||
if (eol) return eol = false, EOL; // Unescape quotes. | ||
var i, | ||
j = I, | ||
c; | ||
if (text.charCodeAt(j) === QUOTE) { | ||
while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); | ||
if ((i = I) >= N) eof = true;else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;else if (c === RETURN) { | ||
eol = true; | ||
if (text.charCodeAt(I) === NEWLINE) ++I; | ||
} | ||
return text.slice(j + 1, i - 1).replace(/""/g, "\""); | ||
} // Find next delimiter or newline. | ||
while (I < N) { | ||
if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;else if (c === RETURN) { | ||
eol = true; | ||
if (text.charCodeAt(I) === NEWLINE) ++I; | ||
} else if (c !== DELIMITER) continue; | ||
return text.slice(j, i); | ||
} // Return last token before EOF. | ||
return eof = true, text.slice(j, N); | ||
} | ||
while ((t = token()) !== EOF) { | ||
var row = []; | ||
while (t !== EOL && t !== EOF) row.push(t), t = token(); | ||
if (f && (row = f(row, n++)) == null) continue; | ||
rows.push(row); | ||
} | ||
return rows; | ||
} | ||
function preformatBody(rows, columns) { | ||
return rows.map(function (row) { | ||
return columns.map(function (column) { | ||
return formatValue(row[column]); | ||
}).join(delimiter); | ||
}); | ||
} | ||
function format(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); | ||
} | ||
function formatBody(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return preformatBody(rows, columns).join("\n"); | ||
} | ||
function formatRows(rows) { | ||
return rows.map(formatRow).join("\n"); | ||
} | ||
function formatRow(row) { | ||
return row.map(formatValue).join(delimiter); | ||
} | ||
function formatValue(value) { | ||
return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; | ||
} | ||
return { | ||
parse: parse, | ||
parseRows: parseRows, | ||
format: format, | ||
formatBody: formatBody, | ||
formatRows: formatRows, | ||
formatRow: formatRow, | ||
formatValue: formatValue | ||
}; | ||
} | ||
function delimitedFormat(delimiter) { | ||
@@ -249,3 +417,3 @@ const parse = function (data, format) { | ||
return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); | ||
return dsvFormat(format.delimiter).parse(data + ''); | ||
} | ||
@@ -390,2 +558,2 @@ dsv.responseType = 'text'; | ||
}))); | ||
})); |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('d3-dsv'), require('topojson-client'), require('vega-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'd3-dsv', 'topojson-client', 'vega-format'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.d3, global.topojson, global.vega)); | ||
}(this, (function (exports, vegaUtil, d3Dsv, topojsonClient, vegaFormat) { 'use strict'; | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega-util'), require('topojson-client'), require('vega-format')) : | ||
typeof define === 'function' && define.amd ? define(['exports', 'vega-util', 'topojson-client', 'vega-format'], factory) : | ||
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vega = {}, global.vega, global.topojson, global.vega)); | ||
})(this, (function (exports, vegaUtil, topojsonClient, vegaFormat) { 'use strict'; | ||
@@ -232,2 +232,170 @@ // https://... file://... //... | ||
var EOL = {}, | ||
EOF = {}, | ||
QUOTE = 34, | ||
NEWLINE = 10, | ||
RETURN = 13; | ||
function objectConverter(columns) { | ||
return new Function("d", "return {" + columns.map(function (name, i) { | ||
return JSON.stringify(name) + ": d[" + i + "] || \"\""; | ||
}).join(",") + "}"); | ||
} | ||
function customConverter(columns, f) { | ||
var object = objectConverter(columns); | ||
return function (row, i) { | ||
return f(object(row), i, columns); | ||
}; | ||
} // Compute unique columns in order of discovery. | ||
function inferColumns(rows) { | ||
var columnSet = Object.create(null), | ||
columns = []; | ||
rows.forEach(function (row) { | ||
for (var column in row) { | ||
if (!(column in columnSet)) { | ||
columns.push(columnSet[column] = column); | ||
} | ||
} | ||
}); | ||
return columns; | ||
} | ||
function pad(value, width) { | ||
var s = value + "", | ||
length = s.length; | ||
return length < width ? new Array(width - length + 1).join(0) + s : s; | ||
} | ||
function formatYear(year) { | ||
return year < 0 ? "-" + pad(-year, 6) : year > 9999 ? "+" + pad(year, 6) : pad(year, 4); | ||
} | ||
function formatDate(date) { | ||
var hours = date.getUTCHours(), | ||
minutes = date.getUTCMinutes(), | ||
seconds = date.getUTCSeconds(), | ||
milliseconds = date.getUTCMilliseconds(); | ||
return isNaN(date) ? "Invalid Date" : formatYear(date.getUTCFullYear()) + "-" + pad(date.getUTCMonth() + 1, 2) + "-" + pad(date.getUTCDate(), 2) + (milliseconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "." + pad(milliseconds, 3) + "Z" : seconds ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + ":" + pad(seconds, 2) + "Z" : minutes || hours ? "T" + pad(hours, 2) + ":" + pad(minutes, 2) + "Z" : ""); | ||
} | ||
function dsvFormat (delimiter) { | ||
var reFormat = new RegExp("[\"" + delimiter + "\n\r]"), | ||
DELIMITER = delimiter.charCodeAt(0); | ||
function parse(text, f) { | ||
var convert, | ||
columns, | ||
rows = parseRows(text, function (row, i) { | ||
if (convert) return convert(row, i - 1); | ||
columns = row, convert = f ? customConverter(row, f) : objectConverter(row); | ||
}); | ||
rows.columns = columns || []; | ||
return rows; | ||
} | ||
function parseRows(text, f) { | ||
var rows = [], | ||
// output rows | ||
N = text.length, | ||
I = 0, | ||
// current character index | ||
n = 0, | ||
// current line number | ||
t, | ||
// current token | ||
eof = N <= 0, | ||
// current token followed by EOF? | ||
eol = false; // current token followed by EOL? | ||
// Strip the trailing newline. | ||
if (text.charCodeAt(N - 1) === NEWLINE) --N; | ||
if (text.charCodeAt(N - 1) === RETURN) --N; | ||
function token() { | ||
if (eof) return EOF; | ||
if (eol) return eol = false, EOL; // Unescape quotes. | ||
var i, | ||
j = I, | ||
c; | ||
if (text.charCodeAt(j) === QUOTE) { | ||
while (I++ < N && text.charCodeAt(I) !== QUOTE || text.charCodeAt(++I) === QUOTE); | ||
if ((i = I) >= N) eof = true;else if ((c = text.charCodeAt(I++)) === NEWLINE) eol = true;else if (c === RETURN) { | ||
eol = true; | ||
if (text.charCodeAt(I) === NEWLINE) ++I; | ||
} | ||
return text.slice(j + 1, i - 1).replace(/""/g, "\""); | ||
} // Find next delimiter or newline. | ||
while (I < N) { | ||
if ((c = text.charCodeAt(i = I++)) === NEWLINE) eol = true;else if (c === RETURN) { | ||
eol = true; | ||
if (text.charCodeAt(I) === NEWLINE) ++I; | ||
} else if (c !== DELIMITER) continue; | ||
return text.slice(j, i); | ||
} // Return last token before EOF. | ||
return eof = true, text.slice(j, N); | ||
} | ||
while ((t = token()) !== EOF) { | ||
var row = []; | ||
while (t !== EOL && t !== EOF) row.push(t), t = token(); | ||
if (f && (row = f(row, n++)) == null) continue; | ||
rows.push(row); | ||
} | ||
return rows; | ||
} | ||
function preformatBody(rows, columns) { | ||
return rows.map(function (row) { | ||
return columns.map(function (column) { | ||
return formatValue(row[column]); | ||
}).join(delimiter); | ||
}); | ||
} | ||
function format(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return [columns.map(formatValue).join(delimiter)].concat(preformatBody(rows, columns)).join("\n"); | ||
} | ||
function formatBody(rows, columns) { | ||
if (columns == null) columns = inferColumns(rows); | ||
return preformatBody(rows, columns).join("\n"); | ||
} | ||
function formatRows(rows) { | ||
return rows.map(formatRow).join("\n"); | ||
} | ||
function formatRow(row) { | ||
return row.map(formatValue).join(delimiter); | ||
} | ||
function formatValue(value) { | ||
return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? "\"" + value.replace(/"/g, "\"\"") + "\"" : value; | ||
} | ||
return { | ||
parse: parse, | ||
parseRows: parseRows, | ||
format: format, | ||
formatBody: formatBody, | ||
formatRows: formatRows, | ||
formatRow: formatRow, | ||
formatValue: formatValue | ||
}; | ||
} | ||
function delimitedFormat(delimiter) { | ||
@@ -249,3 +417,3 @@ const parse = function (data, format) { | ||
return d3Dsv.dsvFormat(format.delimiter).parse(data + ''); | ||
return dsvFormat(format.delimiter).parse(data + ''); | ||
} | ||
@@ -388,2 +556,2 @@ dsv.responseType = 'text'; | ||
}))); | ||
})); |
{ | ||
"name": "vega-loader", | ||
"version": "4.4.1", | ||
"version": "4.5.0", | ||
"description": "Network request and file loading utilities.", | ||
@@ -38,9 +38,9 @@ "keywords": [ | ||
"dependencies": { | ||
"d3-dsv": "^2.0.0", | ||
"node-fetch": "^2.6.1", | ||
"d3-dsv": "^3.0.1", | ||
"node-fetch": "^2.6.7", | ||
"topojson-client": "^3.1.0", | ||
"vega-format": "^1.0.4", | ||
"vega-format": "^1.1.0", | ||
"vega-util": "^1.16.0" | ||
}, | ||
"gitHead": "774165e29850b66ec8b79ba52a7955f1ab936ea6" | ||
"gitHead": "9a3faca4395cade9ecdfde90af98f1c53e9916b2" | ||
} |
Sorry, the diff of this file is not supported yet
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
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
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
139960
1958
26
+ Addedcommander@7.2.0(transitive)
+ Addedd3-dsv@3.0.1(transitive)
+ Addediconv-lite@0.6.3(transitive)
- Removedd3-dsv@2.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
Updatedd3-dsv@^3.0.1
Updatednode-fetch@^2.6.7
Updatedvega-format@^1.1.0