UNPKG

docschema

Version:

Schema declaration and validation library using JsDoc comments

35 lines (29 loc) 766 B
import { DocSchema, shiftStack } from './DocSchema.js' import { DocSchemaParser } from './DocSchemaParser.js' import { DocSchemaValidator } from './DocSchemaValidator.js' import { ValidationError } from './errors/ValidationError.js' /** * Use this function just below a JsDoc comment. * The comment must contain either: * - A single \@enum tag. * - One or more \@param tags, each of them describing * one property of an object. * * @template T * @param {T} [typeCarrier] * @returns {DocSchema<T>} */ export function docSchema(typeCarrier) { shiftStack(1) return new DocSchema(typeCarrier) } /** @type {any} */ const type = null export default docSchema export { DocSchema, DocSchemaParser, DocSchemaValidator, type, ValidationError, }