Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
featurecollection.crs = {type: 'name', properties: {name: crs}};
}
if (options.delimiter === 'auto' && typeof x == 'string') {
options.delimiter = autoDelimiter(x);
if (!options.delimiter) {
callback({
type: 'Error',
message: 'Could not autodetect delimiter'
});
return;
}
}
var parsed = (typeof x == 'string') ?
dsv.dsvFormat(options.delimiter).parse(x) : x;
if (!parsed.length) {
callback(null, featurecollection);
return;
}
var errors = [];
var i;
if (!latfield) latfield = guessLatHeader(parsed[0]);
if (!lonfield) lonfield = guessLonHeader(parsed[0]);
var noGeometry = (!latfield || !lonfield);
if (noGeometry) {
for (i = 0; i < parsed.length; i++) {
export default function dsv(data, format) {
if (format.header) {
data = format.header
.map(stringValue)
.join(format.delimiter) + '\n' + data;
}
return dsvFormat(format.delimiter).parse(data + '');
}
export default function dsv(delimiter, input, init, row) {
if (arguments.length === 3 && typeof init === "function") row = init, init = undefined;
var format = dsvFormat(delimiter);
return text(input, init).then(function(response) {
return format.parse(response, row);
});
}
delimiters.forEach(function (delimiter) {
var res = dsv.dsvFormat(delimiter).parse(x);
if (res.length >= 1) {
var count = keyCount(res[0]);
for (var i = 0; i < res.length; i++) {
if (keyCount(res[i]) !== count) return;
}
results.push({
delimiter: delimiter,
arity: Object.keys(res[0]).length,
});
}
});
export function downloadTextFile(dataRows = [],
delimiter = ",",
fileName = "download.csv") {
const fileContent = dsv
.dsvFormat(delimiter)
.formatRows(dataRows);
downloadFile(fileContent, fileName);
}
delimiters.forEach(function (delimiter) {
var res = dsv.dsvFormat(delimiter).parse(x);
if (res.length >= 1) {
var count = keyCount(res[0]);
for (var i = 0; i < res.length; i++) {
if (keyCount(res[i]) !== count) return;
}
results.push({
delimiter: delimiter,
arity: Object.keys(res[0]).length,
});
}
});
private _parse(): void {
this._data = dsv.dsvFormat(this._delimiter).parse(this._content);
}
function auto(x) {
var delimiter = autoDelimiter(x);
if (!delimiter) return null;
return deleteColumns(dsv.dsvFormat(delimiter).parse(x));
}
psv: function (file, writeOptions) {
writeOptions = writeOptions || {}
try {
return dsv.dsvFormat('|').format(file, writeOptions.columns)
} catch (err) {
reportParseError('psv')
}
},
txt: function (d) { return d },
delimiters.forEach(function (delimiter) {
var res = dsv.dsvFormat(delimiter).parse(x);
if (res.length >= 1) {
var count = keyCount(res[0]);
for (var i = 0; i < res.length; i++) {
if (keyCount(res[i]) !== count) return;
}
results.push({
delimiter: delimiter,
arity: Object.keys(res[0]).length,
});
}
});