@@ -5,8 +5,8 @@ import * as ethjsUtil from 'ethjs-util'
5
5
* @param {string } input string to check hex prefix of
6
6
*/
7
7
export const assertIsHexString = function ( input : string ) : void {
8
- const msg = `This method only supports 0x-prefixed hex strings but input was: ${ input } `
9
8
if ( ! ethjsUtil . isHexString ( input ) ) {
9
+ const msg = `This method only supports 0x-prefixed hex strings but input was: ${ input } `
10
10
throw new Error ( msg )
11
11
}
12
12
}
@@ -16,8 +16,8 @@ export const assertIsHexString = function(input: string): void {
16
16
* @param {Buffer } input value to check
17
17
*/
18
18
export const assertIsBuffer = function ( input : Buffer ) : void {
19
- const msg = `This method only supports Buffer but input was: ${ input } `
20
19
if ( ! Buffer . isBuffer ( input ) ) {
20
+ const msg = `This method only supports Buffer but input was: ${ input } `
21
21
throw new Error ( msg )
22
22
}
23
23
}
@@ -27,8 +27,8 @@ export const assertIsBuffer = function(input: Buffer): void {
27
27
* @param {number[] } input value to check
28
28
*/
29
29
export const assertIsArray = function ( input : number [ ] ) : void {
30
- const msg = `This method only supports number arrays but input was: ${ input } `
31
30
if ( ! Array . isArray ( input ) ) {
31
+ const msg = `This method only supports number arrays but input was: ${ input } `
32
32
throw new Error ( msg )
33
33
}
34
34
}
@@ -38,8 +38,8 @@ export const assertIsArray = function(input: number[]): void {
38
38
* @param {string } input value to check
39
39
*/
40
40
export const assertIsString = function ( input : string ) : void {
41
- const msg = `This method only supports strings but input was: ${ input } `
42
41
if ( typeof input !== 'string' ) {
42
+ const msg = `This method only supports strings but input was: ${ input } `
43
43
throw new Error ( msg )
44
44
}
45
45
}
0 commit comments