diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-05 21:32:01 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-10-05 21:32:01 +0800 |
commit | 1414b8ee8bdb1be901371c4cf7b8a5150d8fb771 (patch) | |
tree | 1b46e817c23ecb26fed8d16e147fe4cb2f007883 /src/utils | |
parent | 209c31f361743bd511e6bb2c494ceeb02e52a7d9 (diff) | |
download | dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar.gz dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar.bz2 dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar.lz dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar.xz dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.tar.zst dexon-sol-tools-1414b8ee8bdb1be901371c4cf7b8a5150d8fb771.zip |
Add type assertions for callback parameters
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/assert.ts | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/utils/assert.ts b/src/utils/assert.ts index eb084129c..0b7a11939 100644 --- a/src/utils/assert.ts +++ b/src/utils/assert.ts @@ -17,6 +17,9 @@ export const assert = { isString(variableName: string, value: string): void { this.assert(_.isString(value), this.typeAssertionMessage(variableName, 'string', value)); }, + isFunction(variableName: string, value: any): void { + this.assert(_.isFunction(value), this.typeAssertionMessage(variableName, 'function', value)); + }, isHexString(variableName: string, value: string): void { this.assert(_.isString(value) && HEX_REGEX.test(value), this.typeAssertionMessage(variableName, 'HexString', value)); |