vikramthyagarajan / node-excel-stream

A utility to read and write JSON data to excel in streams
MIT License
19 stars 10 forks source link

[ExcelReader] Delegate Schema Validation to consumer ? #16

Open vikramkamath opened 3 years ago

vikramkamath commented 3 years ago

Thanks for this tool! I was wondering if it should be possible to not provide schema upfront at all and let the consumer apply schema validation. Sometimes, you just want to parse any excel uploaded without having to worry upfront about the schema.

For example:

import {schema, schemaValidator} from "user-preferred-schema-validator";

const excelReader = new ExcelReader(readableStream); // <=== no schema passed here

...

await excelReader.eachRow(record => {
    schemaValidator.validate(record, schema); // <=== user does this validation upon every record
})

what do you think ?