UNPKG

@bshg/validation

Version:

Validation Library for TypeScript projects

46 lines (45 loc) 1.99 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __exportStar = (this && this.__exportStar) || function(m, exports) { for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.regex = exports.batchValidateThrow = exports.batchValidate = exports.template = exports.validator = void 0; const options_1 = require("./options"); const main_1 = require("./main"); const logger_1 = require("./logger"); const validator = (config) => { const validator = new main_1.Validator(); const _options = { ...options_1.options, ...config.options }; validator.options(_options); validator.config(config); logger_1.LOGGER.info("init", _options === null || _options === void 0 ? void 0 : _options.dev, validator); return validator; }; exports.validator = validator; const template = (config) => { return new main_1.ValidatorTemplate(config); }; exports.template = template; const batchValidate = (template, data) => { return template.batchValidate(...data); }; exports.batchValidate = batchValidate; const batchValidateThrow = (template, data) => { template.batchValidateThrow(...data); }; exports.batchValidateThrow = batchValidateThrow; __exportStar(require("./validators-fn"), exports); __exportStar(require("./configuration"), exports); var regex_1 = require("./utils/regex"); Object.defineProperty(exports, "regex", { enumerable: true, get: function () { return regex_1.regex; } });