如何调用返回承诺的函数?
const checkDatabase = async (row: Row): Promise<boolean> => {
return await checkDatabaseService.check()
}
使用管道,例如
parseStream(steam, {})
.validate(row: Row, processValidationError) : void => {
processValidationError(null, checkDatabase(), 'ok')
}
.on('data-invalid', (row: Row, rowNumber: number, reason: string) => {
console.log(`${JSON.stringify(row)} ${rowNumber} ${reason}`)
}
.on('data', row => email(row))
.on('error', error => console.error(error))
.on('end', (rowCount: number) => console.log(`Processed ${rowCount} rows.`));
.validate 调用不起作用。