aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert/src/index.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-02-24 06:15:29 +0800
committerFabio Berger <me@fabioberger.com>2018-02-24 06:15:29 +0800
commit10aed4606223fc558d9c7f6d98ff11fa7ba393e4 (patch)
tree6b0839b41eb3708a6ee254294e4774984b3af29e /packages/assert/src/index.ts
parent6e43e89b2d6679def241c5014fc08202f74550b2 (diff)
parent10c0c0b6d2fce2a08858cd7ec280ed72d3da0b32 (diff)
downloaddexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar.gz
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar.bz2
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar.lz
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar.xz
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.tar.zst
dexon-sol-tools-10aed4606223fc558d9c7f6d98ff11fa7ba393e4.zip
Merge branch 'development' of github.com:0xProject/0x.js into development
* 'development' of github.com:0xProject/0x.js: Update CHANGELOG Remove unused CHANGELOG entry Remove unused import Change assert.doesConformToShema interface Remove a type assertion Remove type-level validation Access property over this Add type cast Fix tests Add entries to the CHANGELOG Better validate ZeroExConfig on public networks
Diffstat (limited to 'packages/assert/src/index.ts')
-rw-r--r--packages/assert/src/index.ts5
1 files changed, 4 insertions, 1 deletions
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index 7ad574ec7..4d090e493 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -66,8 +66,11 @@ export const assert = {
const isWeb3Provider = _.isFunction(value.send) || _.isFunction(value.sendAsync);
this.assert(isWeb3Provider, this.typeAssertionMessage(variableName, 'Web3.Provider', value));
},
- doesConformToSchema(variableName: string, value: any, schema: Schema): void {
+ doesConformToSchema(variableName: string, value: any, schema: Schema, subSchemas?: Schema[]): void {
const schemaValidator = new 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}