Skip to content

Commit

Permalink
Throw errors not string in StringArbitrary
Browse files Browse the repository at this point in the history
  • Loading branch information
dubzzz committed Mar 30, 2018
1 parent 0ab0694 commit d0027d7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/check/arbitrary/StringArbitrary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ function StringArbitrary(charArb: Arbitrary<string>, aLength?: number, bLength?:
}

function Base64StringArbitrary(minLength: number, maxLength: number) {
if (minLength > maxLength) throw 'Minimal length should be inferior or equal to maximal length';
if (minLength % 4 !== 0) throw 'Minimal length of base64 strings must be a multiple of 4';
if (maxLength % 4 !== 0) throw 'Maximal length of base64 strings must be a multiple of 4';
if (minLength > maxLength) throw new Error('Minimal length should be inferior or equal to maximal length');
if (minLength % 4 !== 0) throw new Error('Minimal length of base64 strings must be a multiple of 4');
if (maxLength % 4 !== 0) throw new Error('Maximal length of base64 strings must be a multiple of 4');
return StringArbitrary(base64(), minLength, maxLength).map(s => {
switch (s.length % 4) {
case 0: return s;
Expand Down

0 comments on commit d0027d7

Please sign in to comment.