You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
377 B
JavaScript
12 lines
377 B
JavaScript
1 year ago
|
const fs = require('fs');
|
||
|
|
||
|
let file = JSON.parse(fs.readFileSync('data.json'));
|
||
|
const oldLen = file.length;
|
||
|
|
||
|
file = file.filter((value, index, array) => {
|
||
|
return (value.solution.length === 5 && value.solution !== 'ERROR')
|
||
|
})
|
||
|
console.log(`Filtered to ${file.length} items from ${oldLen} items`)
|
||
|
|
||
|
fs.writeFileSync('data-filtered.json', JSON.stringify(file))
|
||
|
console.log('done')
|