ga-wdi-boston/ruby-vs-js-array-methods-study

Assigning value vs Equality check -- while loop in `lib/people.js` ?

Closed this issue · 1 comments

Could be that I'm just misunderstanding loadPeople but should it not be an equality check? I see a comment on that line about jshint as well so not sure if switching to eslint has anything to do with this?

const loadPeople = () =>
  new Promise((resolve, reject) => {
    const people = []
    const fs = require('fs')
    const parse = require('csv').parse
    const parser = parse({ columns: true })

    const input = fs.createReadStream('data/people.csv')
    input.on('error', e => reject(e))

    parser.on('readable', () => {
      let record
      while (record = parser.read()) { // jshint ignore:line
        people.push(new Person(record))
      }
    })

    parser.on('error', e => reject(e))
    parser.on('finish', () => resolve(people))
    input.pipe(parser)
  })

specific line is:

while (record = parser.read()) { // jshint ignore:line
gaand commented

I should not be an equality check. This code is also used in https://github.com/ga-wdi-boston/js-array-iteration-methods