aboutsummaryrefslogtreecommitdiffstats
path: root/packages/assert
diff options
context:
space:
mode:
authorJacob Evans <dekz@dekz.net>2018-02-27 10:12:11 +0800
committerJacob Evans <jacob@dekz.net>2018-02-27 10:47:09 +0800
commit6961169f89c4cd8480aca9c720cd8299aec9bbc0 (patch)
tree51b9a6a2f0dbaee50a9758a7983fe201d5898354 /packages/assert
parent3d66feb89f8e4cfcb0b5251a96d02ef31f3ae34b (diff)
parent709fa9e02ec21cee9fc145b4a578742c8dd190aa (diff)
downloaddexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar.gz
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar.bz2
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar.lz
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar.xz
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.tar.zst
dexon-sol-tools-6961169f89c4cd8480aca9c720cd8299aec9bbc0.zip
Merge branch 'development' into feature/0x.js/lowercase-addresses
Diffstat (limited to 'packages/assert')
-rw-r--r--packages/assert/CHANGELOG.md3
-rw-r--r--packages/assert/src/index.ts5
2 files changed, 6 insertions, 2 deletions
diff --git a/packages/assert/CHANGELOG.md b/packages/assert/CHANGELOG.md
index fff014811..6721c4cb6 100644
--- a/packages/assert/CHANGELOG.md
+++ b/packages/assert/CHANGELOG.md
@@ -1,8 +1,9 @@
# CHANGELOG
-## v0.1.XX - TBD
+## v0.1.0 - _TBD, 2018_
* Remove isETHAddressHex checksum address check and assume address will be lowercased (#373)
+ * Add an optional parameter `subSchemas` to `doesConformToSchema` method (#385)
## v0.0.18 - _February 9, 2017_
diff --git a/packages/assert/src/index.ts b/packages/assert/src/index.ts
index a9d553487..40d083cb6 100644
--- a/packages/assert/src/index.ts
+++ b/packages/assert/src/index.ts
@@ -63,8 +63,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}