UNPKG

@backland/schema

Version:

TypeScript schema declaration and validation library with static type inference

37 lines (35 loc) 893 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ObjectField = void 0; var _CircularDeps = require("../CircularDeps"); var _FieldType = require("./FieldType"); /** * Used to represent an object as another object field */ class ObjectField extends _FieldType.FieldType { static is(t) { return (0, _FieldType.isFieldInstance)(t) && t.typeName === 'object'; } constructor(def) { super({ def: def, name: 'object' }); this.utils = { // @ts-ignore circular object: _CircularDeps.CircularDeps.createObjectType(def) }; this.parse = this.applyParser({ parse: (input, _options) => { return this.utils.object.parse(input, _options); } }); } static create = def => { return new ObjectField(def); }; } exports.ObjectField = ObjectField; //# sourceMappingURL=ObjectField.js.map