From 86213c887b101044ae2f3ea393fee927842dbde2 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Sun, 12 Aug 2018 15:16:16 +0200 Subject: inequality sonification project --- client/data.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 client/data.js (limited to 'client/data.js') diff --git a/client/data.js b/client/data.js new file mode 100644 index 0000000..15792c9 --- /dev/null +++ b/client/data.js @@ -0,0 +1,23 @@ +const files = [ + "housing-costs-and-income-inequality", + "income-inequality-over-time", + "shares-of-wealth", +] + +const dataPromises = files.map(name => { + return fetch('./data/' + name + '.csv').then(rows => { + return rows.text() + }).then(text => { + let lines = text.split('\n').map(line => line.split(',')) + const h = lines.shift() + return { name, h, lines, } + }) +}) +const allPromises = Promise.all(dataPromises).then(data => { + return data.reduce((a,b) => { a[b.name]=b, a }, {}) +}) +const load = () => { + return allPromises +} + +export { load } \ No newline at end of file -- cgit v1.2.3-70-g09d2