Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function auto(x) {
var delimiter = autoDelimiter(x);
if (!delimiter) return null;
return deleteColumns(dsv.dsv(delimiter).parse(x));
}
delimiters.forEach(function(delimiter) {
var res = dsv.dsv(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,
});
}
});
function dsv(data, format) {
if (data) {
var h = format.header;
data = (h ? h.join(format.delimiter) + '\n' : '') + data;
}
return d3_dsv.dsv(format.delimiter).parse(data);
}
featurecollection = { type: 'FeatureCollection', features: features };
if (crs !== '') {
featurecollection.crs = { type: 'name', properties: { name: crs } };
}
if (options.delimiter === 'auto' && typeof x == 'string') {
options.delimiter = autoDelimiter(x);
if (!options.delimiter) return callback({
type: 'Error',
message: 'Could not autodetect delimiter'
});
}
var parsed = (typeof x == 'string') ?
dsv.dsv(options.delimiter).parse(x) : x;
if (!parsed.length) return callback(null, featurecollection);
var errors = [];
var noGeometry = false;
if (!latfield || !lonfield) {
for (var f in parsed[0]) {
if (!latfield && isLat(f)) latfield = f;
if (!lonfield && isLon(f)) lonfield = f;
}
if (!latfield || !lonfield) {
noGeometry = true;
}
}