UNPKG

691 BJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright Google LLC All Rights Reserved.
5 *
6 * Use of this source code is governed by an MIT-style license that can be
7 * found in the LICENSE file at https://angular.io/license
8 */
9Object.defineProperty(exports, "__esModule", { value: true });
10exports.formatValidator = void 0;
11const core_1 = require("@angular-devkit/core");
12async function formatValidator(data, dataSchema, formats) {
13 const registry = new core_1.schema.CoreSchemaRegistry();
14 for (const format of formats) {
15 registry.addFormat(format);
16 }
17 const validator = await registry.compile(dataSchema);
18 return validator(data);
19}
20exports.formatValidator = formatValidator;