From 3120d854f855a01ad7bce3427a64d931de1879d3 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Tue, 20 Feb 2018 12:09:39 -0800 Subject: Update CHANGELOG --- packages/assert/src/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'packages/assert/src/index.ts') diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts index 71f2cbeb2..4d090e493 100644 --- a/packages/assert/src/index.ts +++ b/packages/assert/src/index.ts @@ -68,7 +68,9 @@ export const assert = { }, doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void { const schemaValidator = new SchemaValidator(); - _.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator)); + if (!_.isUndefined(subSchemas)) { + _.map(subSchemas, schemaValidator.addSchema.bind(schemaValidator)); + } const validationResult = schemaValidator.validate(value, schema); const hasValidationErrors = validationResult.errors.length > 0; const msg = `Expected ${variableName} to conform to schema ${schema.id} -- cgit