@ifvictr/

Mindset Data Calculator Script

Nodejs

No description

fork
loading
Files
  • index.js
  • data.csv
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
const csv = require('csv-parser')
const fs = require('fs')
const results = []
const points = {}

fs.createReadStream('data.csv')
    .pipe(csv())
    .on('data', data => results.push(data))
    .on('end', () => {
        results.map(result => {
            const coord = `${result.success},${result.mindset}`
            if (!points.hasOwnProperty(coord)) {
                points[coord] = 0
            }
            points[coord]++
        })
        console.log(points)
    })
node v10.16.0