diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-21 04:09:39 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-02-21 04:09:39 +0800 |
commit | 3120d854f855a01ad7bce3427a64d931de1879d3 (patch) | |
tree | 79c8a3e52a2c15d718c0b45d44ff3e6bc11fe832 /packages/assert/src/index.ts | |
parent | c85c14210fb3af93733430328d07b46007c84da1 (diff) | |
download | dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar.gz dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar.bz2 dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar.lz dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar.xz dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.tar.zst dexon-sol-tools-3120d854f855a01ad7bce3427a64d931de1879d3.zip |
Update CHANGELOG
Diffstat (limited to 'packages/assert/src/index.ts')
-rw-r--r-- | packages/assert/src/index.ts | 4 |
1 files changed, 3 insertions, 1 deletions
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} |