UNPKG

mindee

Version:

Mindee Client Library for Node.js

24 lines (23 loc) 650 B
import { DataSchemaReplace } from "./dataSchemaReplace.js"; /** * Modify the Data Schema. */ export class DataSchema { constructor(dataSchema) { if (typeof dataSchema === "string") { this.replace = new DataSchemaReplace(JSON.parse(dataSchema)["replace"]); } else if (dataSchema instanceof DataSchema) { this.replace = dataSchema.replace; } else { this.replace = new DataSchemaReplace(dataSchema["replace"]); } } toJSON() { return { replace: this.replace?.toJSON() }; } toString() { return JSON.stringify(this.toJSON()); } }