UNPKG

@sprucelabs/spruce-cli

Version:

Command line interface for building Spruce skills.

27 lines 972 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const schema_1 = require("@sprucelabs/schema"); const validateAndNormalizer = { validateAndNormalize(schema, options) { const values = { ...(0, schema_1.defaultSchemaValues)(schema), ...this.stripUndefined(options), }; (0, schema_1.validateSchemaValues)(schema, values, {}); const normalized = (0, schema_1.normalizeSchemaValues)(schema, values); return this.stripUndefined(normalized); }, stripUndefined(normalized) { const noUndefined = {}; Object.keys(normalized).forEach((key) => { // @ts-ignore if (normalized[key] !== undefined) { //@ts-ignore noUndefined[key] = normalized[key]; } }); return noUndefined; }, }; exports.default = validateAndNormalizer; //# sourceMappingURL=validateAndNormalize.utility.js.map