Welcome to the Linux Foundation Forum!

under var in session 8, return (_, cb)

I could not understand and inspect the "" in return query below code.
How I should search the "
".
Google does not identify the "_" in search engine.

Syuhei Saito

const readers = files.map((file) => {
return (_, cb) => {
readFile(file, (err, contents) => {
if (err) {
print(err)
cb(null, Buffer.alloc(0))
} else cb(null, contents)
})
}
})

Comments

  • @SyuheiSaito when we want to ignore a parameter, it's convention to use an underscore to signal that the parameter isn't important. We have to define it to get the cb parameter.

    In this case we're signalling that the args argument that's passed to each function by fastseries (see http://npm.im/fastseries) isn't relevant to us, so use an _ to signal: don't bother with this, it's in the way, but it's not important.

Categories

Upcoming Training