Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.map(file => matchWords(fs.readFileSync(file, 'utf8')))
.flatten()
.value()
const counts = files.map(
f => (matchWords(fs.readFileSync(f, 'utf8')) || []).length
)
const { average, sum } = require('simple-statistics')
const results: Record = {
'total files': files.length,
'total words': sum(counts),
'unique words': chain(words)
.flatten()
.uniq()
.value().length,
'average words per file': Math.floor(average(counts)),
}
console.log(`\n## ${title}\n`)
console.log('Stat | Value')
console.log('---- | -----')
Object.keys(results).forEach(stat => {
console.log([stat, results[stat]].join(' | '))
})
}
_.each(polyFC.features, function(poly){
if(!poly.properties){
poly.properties = {}
}
var values = []
_.each(ptFC.features, function(pt){
t.inside(pt, poly, function(err, isInside){
if(isInside){
values.push(pt.properties[inField])
}
})
})
poly.properties[outField] = ss.average(values)
})