wikibase-dump-filter
Version:
Filter and format a newline-delimited JSON stream of Wikibase entities
20 lines (14 loc) • 400 B
JavaScript
import { updateProgressBar } from './update_progress_bar.js'
let total = 0
let kept = 0
let lastEntityId = ''
export function updateWithLastData () {
updateProgressBar(lastEntityId, kept, total)
}
export const beforeFilter = () => total++
export function afterFilter (entity) {
kept++
lastEntityId = entity.id
updateWithLastData()
}
export const afterNegativeFilter = updateWithLastData