formzilla
Version:
Fastify plugin for parsing multipart/form data
20 lines (18 loc) • 321 B
JavaScript
class FieldParserWithSchema {
props;
constructor(props) {
this.props = props;
}
parseField(name, value) {
if (this.props[name]?.type !== "string") {
try {
return JSON.parse(value);
} catch {
void 0;
}
}
return value;
}
}
exports.FieldParserWithSchema = FieldParserWithSchema;
;