UNPKG

mindee

Version:

Mindee Client Library for Node.js

40 lines (39 loc) 1.48 kB
export class DataSchemaField { constructor(fields) { this.name = fields["name"]; this.title = fields["title"]; this.isArray = fields["is_array"]; this.type = fields["type"]; this.classificationValues = fields["classification_values"]; this.uniqueValues = fields["unique_values"]; this.description = fields["description"]; this.guidelines = fields["guidelines"]; this.nestedFields = fields["nested_fields"]; } toJSON() { const out = { name: this.name, title: this.title, // eslint-disable-next-line @typescript-eslint/naming-convention,camelcase is_array: this.isArray, type: this.type, }; // eslint-disable-next-line camelcase if (this.classificationValues !== undefined) out.classification_values = this.classificationValues; // eslint-disable-next-line camelcase if (this.uniqueValues !== undefined) out.unique_values = this.uniqueValues; if (this.description !== undefined) out.description = this.description; if (this.guidelines !== undefined) out.guidelines = this.guidelines; // eslint-disable-next-line camelcase if (this.nestedFields !== undefined) out.nested_fields = this.nestedFields; return out; } toString() { return JSON.stringify(this.toJSON()); } }