Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
model: rr[2],
length: +rr[3]
};
return pr;
});
date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;
// csvFormat(...) ============================================================================
str = d3Dsv.csvFormat(parseRowsMappedArray);
str = d3Dsv.csvFormat(parseRowsMappedArray, columns);
// csvFormatRows(...) ========================================================================
str = d3Dsv.csvFormatRows(parseRowsMappedArray.map((d, i) => [
d.year.getFullYear().toString(),
d.make,
d.model,
d.length.toString()
]));
// ------------------------------------------------------------------------------------------
// Test TSV
// ------------------------------------------------------------------------------------------
// tsvParse(...) ============================================================================
length: +rr[3]
};
return pr;
});
date = parseRowsMappedArray[0].year;
str = parseRowsMappedArray[0].make;
str = parseRowsMappedArray[0].model;
num = parseRowsMappedArray[0].length;
// csvFormat(...) ============================================================================
str = d3Dsv.csvFormat(parseRowsMappedArray);
str = d3Dsv.csvFormat(parseRowsMappedArray, columns);
// csvFormatRows(...) ========================================================================
str = d3Dsv.csvFormatRows(parseRowsMappedArray.map((d, i) => [
d.year.getFullYear().toString(),
d.make,
d.model,
d.length.toString()
]));
// ------------------------------------------------------------------------------------------
// Test TSV
// ------------------------------------------------------------------------------------------
// tsvParse(...) ============================================================================
return {
ID: i + 1,
MAPEO_ID: o.id,
DATE: formatCsvDate(o.created_at),
TIME: formatCsvTime(o.created_at),
COMMENT: o.tags.notes || o.tags.note,
PHOTOS,
...locationData
}
})
// We do this to order the columns of the CSV, otherwise csvFormat column
// order is non-deterministic
const columns = 'ID,X,Y,DATE,TIME,COMMENT,PHOTOS,MAPEO_ID'.split(',')
return csvFormat(rows, columns)
}
// We do this to order the columns of the CSV, otherwise csvFormat column
// order is non-deterministic
const columns = [
'$id',
'$created',
'$modified',
'$lon',
'$lat',
'$utmX',
'$utmY',
'$utmZone',
'$photos'
].concat(Object.keys(allKeys).sort(), '$version')
return csvFormat(rows, columns)
}
type: UPDATE_REMOTE_FILES_LOG,
payload: `downloading existing flows file ${file.fileName}`
});
const exists = await get(`${repoRawContent}/${branch}/data/${file.fileName}`,{ responseType: 'text', responseEncoding: 'utf8'})
if (exists.status === 200) {
// append new rows at end of the existing file
file.data = csvParse(exists.data).concat(file.data)
}
// else it's a new file nothing to do
// actually yes we should update datapackage see issue #70
}
dispatch({
type: UPDATE_REMOTE_FILES_LOG,
payload: `uploading ${file.fileName}`
});
let fileGit = await repo.git.blobs.create({content: Base64.encode(csvFormat(file.data)), encoding: 'base64'});
let filePath = `data/${file.fileName}`;
treeItems.push({
path: filePath,
sha: fileGit.sha,
mode: "100644",
type: "blob"
})
}
dispatch({
type: UPDATE_REMOTE_FILES_LOG,
payload: `creating tree`
});
let tree = await repo.git.trees.create({
tree: treeItems,
base_tree: baseReference.object.sha
});
onClick={e => {
const url = (e.target.href = URL.createObjectURL(
new window.Blob(
[
csvFormat(
withCards.map(s => ({
status: s.dir === 1 ? 'folgen' : 'ignorieren',
name: s.card.user.name,
partei: s.card.payload.party,
jahrgang: s.card.payload.yearOfBirth,
reoublikLink: `https://www.republik.ch/~${s.card.user.slug}`,
smartvoteLink:
s.cardCache.payload.councilOfStates.linkSmartvote ||
s.cardCache.payload.nationalCouncil.linkSmartvote
}))
)
],
{ type: 'text/csv' }
)
))
setTimeout(function() {
csv: function (file, writeOptions) {
writeOptions = writeOptions || {}
file = formattingPreflight(file, 'csv')
try {
return dsv.csvFormat(file, writeOptions.columns)
} catch (err) {
reporters.parseError('csv')
}
},
tsv: function (file, writeOptions) {
function writeCSV(data, path) {
const csvStr = dsv.csvFormat(data, ['query', 'intent']);
fs.writeFileSync(path, csvStr, {encoding: 'utf8'});
}
onClick={e => {
const url = (e.target.href = URL.createObjectURL(
new window.Blob([csvFormat(props.values)], { type: 'text/csv' })
))
setTimeout(function() {
URL.revokeObjectURL(url)
}, 50)
}}
>
onPaste: e => {
const clipboardData = e.clipboardData || window.clipboardData
let parsedTsv
try {
parsedTsv = tsvParse(clipboardData.getData('Text'))
} catch (e) {}
if (parsedTsv && parsedTsv.columns.length > 1) {
e.preventDefault()
onChange(data.set('values', csvFormat(parsedTsv)))
}
}
})}